#20617: AuthenticationForm ignores setting "username" field's label to an empty
string
-------------------------------+--------------------
Reporter: xor-xor | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.auth | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
When I inherit "django.contrib.auth.forms.AuthenticationForm" and set the
"username" field's label to an empty string:
{{{
username = forms.CharField(label='')
}}}
...it is ignored and the "Username:" label is rendered in HTML output.
Trying the same thing with "password" field works as expected (i.e. label
is not rendered), so this behaviour is inconsistent.
I think it is related to the following if statement in
django/contrib/auth/forms.py file:
{{{
if self.fields['username'].label is None:
self.fields['username'].label =
capfirst(self.username_field.verbose_name)
}}}
(see also: [https://code.djangoproject.com/ticket/19573 ticket #19573])
--
Ticket URL: <https://code.djangoproject.com/ticket/20617>
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.f27c2f6e85fc2620aeb164bf27e314fd%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.