Today I was using {{{AuthenticationForm}}} to log users in but I use a
custom User model and it specifies {{{USERNAME_FIELD}}} as email.
So, when I rendered the form {{{({{ form }})}}} I saw this:
{{{
<input type="text" name="username" autofocus="" autocapitalize="none"
autocomplete="off" maxlength="254" required="" id="id_username">
}}}
It was using {{{text}}} type input field Though It should render
{{{email}}} type field.
I don't know if it is a bug or it was intentional.
If it is a bug I would like to submit a PR! :)
--
Ticket URL: <https://code.djangoproject.com/ticket/31972>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Maksudul Haque
--
Ticket URL: <https://code.djangoproject.com/ticket/31972#comment:1>
* status: assigned => closed
* resolution: => wontfix
* type: Bug => New feature
* component: Forms => contrib.auth
Comment:
Yes it's intentional, this isn't worth the extra complexity.
[https://docs.djangoproject.com/en/3.1/topics/auth/customizing/#custom-
users-and-the-built-in-auth-forms The built-in auth forms] make several
assumptions about the user model. You need to create a subclass of
`AuthenticationForm` if you want to use a different widget.
--
Ticket URL: <https://code.djangoproject.com/ticket/31972#comment:2>