Opened 6 years ago

Last modified 6 years ago

#30164 closed Bug

Changing attributes in the default Authentication Form — at Version 1

Reported by: Oskar Haller Owned by: nobody
Component: contrib.auth Version: 2.1
Severity: Normal Keywords: Authentication Form
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Oskar Haller)

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?

Change History (1)

comment:1 by Oskar Haller, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top