From 54c9ac8e438659e66e42fc0add7a0e1a45c53870 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 19 Oct 2018 16:39:25 +1300 Subject: [PATCH] Improve password form formatting Borrow the formatting from some of our other forms which looks much nicer (and shows field errors properly). Signed-off-by: Paul Eggleton --- .../registration/password_change_form.html | 23 ++++++++++++++++++- .../registration/password_reset_confirm.html | 23 ++++++++++++++++++- .../registration/password_reset_form.html | 23 ++++++++++++++++++- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/templates/registration/password_change_form.html b/templates/registration/password_change_form.html index c349f3f..da54266 100644 --- a/templates/registration/password_change_form.html +++ b/templates/registration/password_change_form.html @@ -3,7 +3,28 @@ {% block content %}
- {{ form.as_p }} + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + + {% for field in form.visible_fields %} + {% if field.name in form.errors %} +
+ {{ field.errors }} + {% else %} +
+ {% endif %} +
+ {{ field.label_tag }} +
+
+ {{ field }} +
+

+ {{ field.help_text|safe }} +

+
+ {% endfor %} {% csrf_token %} diff --git a/templates/registration/password_reset_confirm.html b/templates/registration/password_reset_confirm.html index 98dd0b6..20b8e01 100644 --- a/templates/registration/password_reset_confirm.html +++ b/templates/registration/password_reset_confirm.html @@ -6,7 +6,28 @@ {% if validlink %} - {{ form.as_p }} + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + + {% for field in form.visible_fields %} + {% if field.name in form.errors %} +
+ {{ field.errors }} + {% else %} +
+ {% endif %} +
+ {{ field.label_tag }} +
+
+ {{ field }} +
+

+ {{ field.help_text|safe }} +

+
+ {% endfor %} {% csrf_token %} diff --git a/templates/registration/password_reset_form.html b/templates/registration/password_reset_form.html index bb2ea93..b8ef4c3 100644 --- a/templates/registration/password_reset_form.html +++ b/templates/registration/password_reset_form.html @@ -3,7 +3,28 @@ {% block content %} - {{ form.as_p }} + {% for hidden in form.hidden_fields %} + {{ hidden }} + {% endfor %} + + {% for field in form.visible_fields %} + {% if field.name in form.errors %} +
+ {{ field.errors }} + {% else %} +
+ {% endif %} +
+ {{ field.label_tag }} +
+
+ {{ field }} +
+

+ {{ field.help_text|safe }} +

+
+ {% endfor %} {% csrf_token %}