Skip to content

Commit 70ee2b6

Browse files
committed
Show errors in registration form error
This commit is mirroring ab86ca9 in days/053-056. Previously, the registration form would not show any field errors that might occur during registration. This commit updates the `registration_form.html` template in the demo as well as the starter code to show occurring field errors.
1 parent 2c52e6b commit 70ee2b6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

days/069-072-django-rest/demo/mysite/templates/django_registration/registration_form.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,40 @@ <h2>Sign up today!</h2>
1414
<div class="mui-textfield">
1515
{{ form.username.label }}
1616
{{ form.username }}
17+
<div class="mui--text-danger">
18+
{% for error in form.username.errors %}
19+
{{ error }}
20+
{% endfor %}
21+
</div>
1722
</div>
1823
<div class="mui-textfield">
1924
{{ form.email.label }}
2025
{{ form.email }}
26+
<div class="mui--text-danger">
27+
{% for error in form.email.errors %}
28+
{{ error }}
29+
{% endfor %}
30+
</div>
2131
</div>
2232
<div class="mui-textfield">
2333
{{ form.password1.label }}
2434
{{ form.password1 }}
35+
<div class="mui--text-danger">
36+
{% for error in form.password1.errors %}
37+
{{ error }}
38+
{% endfor %}
39+
</div>
2540
</div>
2641
<div class="mui-textfield">
2742
{{ form.password2.label }}
2843
{{ form.password2 }}
44+
<div class="mui--text-danger">
45+
{% for error in form.password2.errors %}
46+
{{ error }}
47+
{% endfor %}
48+
</div>
2949
</div>
50+
<!-- {{ form.as_p }} -->
3051

3152
<input class="mui-btn mui-btn--primary" type="submit" value="{% trans 'Submit' %}" />
3253
</form>
-657 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)