#30164: Changing attributes in the default Authentication Form
-------------------------------------+-------------------------------------
Reporter: Oskar Haller | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Resolution:
Keywords: Authentication Form | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Oskar Haller:
Old description:
> The following code works
>
> {{{
> class LoginForm(AuthenticationForm):
> """
> adds helptext to authentication
> """
> def __init__(self, *args, **kwargs):
> super(LoginForm, self).__init__(*args, **kwargs)
> self.fields['username'].help_text = _("Enter your E-Mail
> address")
> self.fields['password'].help_text = _("Enter your password")
> }}}
>
> However, from this documentation
> [https://docs.djangoproject.com/en/2.1/topics/forms/modelforms
> /#modelforms-overriding-default-fields] I would have guessed that I could
> simply specify those elements with a MetaClass. But that did not work.
>
> Is that a bug or just something I'm not aware of?
New description:
The following code works
{{{
class LoginForm(AuthenticationForm):
"""
adds helptext to authentication
"""
def __init__(self, *args, **kwargs):
super(LoginForm, self).__init__(*args, **kwargs)
self.fields['username'].help_text = _("Enter your E-Mail address")
self.fields['password'].help_text = _("Enter your password")
}}}
However, from this documentation
[https://docs.djangoproject.com/en/2.1/topics/forms/modelforms
/#modelforms-overriding-default-fields] I would have guessed that I could
simply specify those elements with a MetaClass. But that did not work.
Is that a bug or just something I'm not aware of?
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30164#comment:1>
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/062.9f600401861eca5b4c2e5bf85dba97e7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.