Opened 12 years ago

Closed 11 years ago

#20357 closed Bug (fixed)

Check username field label for None

Reported by: zhenghao12@… Owned by: nobody
Component: contrib.auth Version: dev
Severity: Normal Keywords: python
Cc: stefan.berder@… Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Sometimes when designing "log-in" forms, there is a necessity to hide the labels and use input element placeholders to identify the fields. When I entered the following in my form:

username = CharField(label='')

the generated HTML still contained the Username <label> element.

It turns out that in line 173 of django.contrib.auth.forms, the boolean test is too broad/generic. It does not take into consideration when the label is deliberately set to an empty string.

The fix to this would affect django/contrib/auth/forms.py file.

I have created a pull request in github: #1046.

Change History (3)

comment:1 by Simon Charette, 12 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted
Version: 1.5master

comment:2 by Simon Charette, 11 years ago

Triage Stage: AcceptedReady for checkin

PR looks RFC, will commit soon.

comment:3 by Simon Charette <charette.s@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 0732c8e8c6e156d4d9a4a1cc02d631fe41342bf8:

Fixed #20357 -- Allow empty username field label in AuthentificationForm.

Note: See TracTickets for help on using tickets.
Back to Top