#19573: It is not possible to overwrite field label in AuthenticationForm
--------------------------------------+------------------------
     Reporter:  jan.munclinger@…      |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  contrib.auth          |    Version:  1.5-beta-1
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+------------------------
 If I inherit "django.contrib.auth.forms.AuthenticationForm" and specify my
 custom "username" field
 {{{
 username = forms.CharField(label=_("Name"), max_length=75)
 }}}
 it ignores my label.

 The reason is the last line of the init method, which set the label.
 
https://github.com/django/django/commit/70a0de37d132e5f1514fb939875f69649f103124#L10R164

 There could be an if statement:
 {{{
 if not self.fields['username'].label:
     self.fields['username'].label =
 capfirst(self.username_field.verbose_name)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19573>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to