#25973: Django 1.9 CBV - Form field error still being rendered in template after
deletion
-------------------------------+---------------------------------
Reporter: pshumba | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.9
Severity: Normal | Keywords: Form error deletion
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------
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>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25973>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.3f77de319d1c1f2a7e2a15e196595d3b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.