Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25973 closed Bug (duplicate)

Django 1.9 CBV - Form field error still being rendered in template after deletion

Reported by: pshumba Owned by: nobody
Component: Generic views Version: 1.9
Severity: Normal Keywords: Form error deletion
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Before rendering template code is supposed to remove email field error on unique validation
"Foo with this Email address already exists."

Code works on previous version of Django 1.8.4
Django 1.9 displays error in template

Model:

class  Foo(models.Model):
     email = models.EmailAddress(unique = True)

View:

from django.views.generic import CreateView

Class BarCreateView(CreateView):
     
       def form_invalid(self, form):
               if form.has_error('email', 'unique'):
                      form.errors.pop('email', None)
               return super(BarCreateView, self).form_invalid(form)

Template:

        <form id="login_form" method="post" action="">
            {% csrf_token %}
            {{form}}
            <input type="submit" value="Submit" />
        </form>

Change History (1)

comment:1 by Alasdair Nicol, 9 years ago

Resolution: duplicate
Status: newclosed

I believe this is a duplicate of #25548, which will be fixed in the upcoming 1.9.1 release. Please could you test with the latest 1.9.X branch?

Version 0, edited 9 years ago by Alasdair Nicol (next)
Note: See TracTickets for help on using tickets.
Back to Top