From 19d000aec786089c6359d86b52dda8481165a741 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 4 Oct 2020 16:00:50 -0700 Subject: [PATCH] Show errors in edit user form and remove email email was triggering the form to reject becuase of uniqueness --- bookwyrm/forms.py | 2 +- bookwyrm/templates/edit_user.html | 18 +++++++++++++----- bookwyrm/view_actions.py | 6 +++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 7b18a2ff..ee6a5667 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -99,7 +99,7 @@ class EditUserForm(CustomForm): class Meta: model = models.User fields = [ - 'avatar', 'name', 'email', 'summary', 'manually_approves_followers' + 'avatar', 'name', 'summary', 'manually_approves_followers' ] help_texts = {f: None for f in fields} diff --git a/bookwyrm/templates/edit_user.html b/bookwyrm/templates/edit_user.html index df620df4..1d2db706 100644 --- a/bookwyrm/templates/edit_user.html +++ b/bookwyrm/templates/edit_user.html @@ -2,24 +2,32 @@ {% block content %}
+

Profile

+ {% if form.non_field_errors %} +

{{ form.non_field_errors }}

+ {% endif %}
{% csrf_token %} -

Profile

{{ form.avatar }} + {% for error in form.avatar.errors %} +

{{ error | escape }}

+ {% endfor %}

{{ form.name }} + {% for error in form.name.errors %} +

{{ error | escape }}

+ {% endfor %}

{{ form.summary }} -

-

- - {{ form.email }} + {% for error in form.summary.errors %} +

{{ error | escape }}

+ {% endfor %}