#27515: Make AuthenticationForm use the username length from the user model
-------------------------------------+-------------------------------------
     Reporter:  Ramin Farajpour      |                    Owner:  Ramin
  Cami                               |  Farajpour Cami
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  contrib.auth         |                  Version:  1.10
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * status:  closed => new
 * resolution:  invalid =>


Old description:

> Hi,
>
> http://127.0.0.1:8000/admin/
>

> {{{
> <form action="/admin/" method="post" id="login-form">
> <input type="hidden" name="csrfmiddlewaretoken" value="">
>   <div class="form-row">
>     <label class="required" for="id_username">Username:</label>
> <input autofocus="" id="id_username" maxlength="254" name="username"
> type="text" required="">
> }}}
>
> `maxlength="150"` is Right,

New description:

 `AuthenticationForm` has a hardcoded `max_length=254` (#19130). It might
 be able to use the max length from the user model with something like:
 `self.fields['username'].max_length =
 UserModel._meta.get_field(UserModel.USERNAME_FIELD).max_length` in
 `AuthenticationForm.__init__()`.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27515#comment:7>
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/065.eb01c6674c009e8ddb7ec9750dc140b2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to