[Django] #20617: AuthenticationForm ignores setting "username" field's label to an empty string

5 views
Skip to first unread message

Django

unread,
Jun 18, 2013, 9:46:36 AM6/18/13
to django-...@googlegroups.com
#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.

Django

unread,
Jun 18, 2013, 12:01:28 PM6/18/13
to django-...@googlegroups.com
#20617: AuthenticationForm ignores setting "username" field's label to an empty
string
-------------------------------+--------------------------------------
Reporter: xor-xor | Owner: nobody
Type: Uncategorized | Status: closed
Component: contrib.auth | Version: 1.5
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by bmispelon):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0


Comment:

Hi,

This issue has already been reported in ticket #20357 and a fix was
commited with commit 0732c8e8c6e156d4d9a4a1cc02d631fe41342bf8.

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/20617#comment:1>

Reply all
Reply to author
Forward
0 new messages