#29508: Simplify overriding `login_form` in AdminSite
-------------------------------------+-------------------------------------
Reporter: Rémi Lapeyre | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 2.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):
* cc: Carlton Gibson (added)
* status: new => closed
* resolution: => invalid
Comment:
I'm afraid I'm not seeing how this comes up at all.
The expected usage is to subclass `AdminSite` and to set `login_form` in
your class definition, importing your custom form class there.
If you do this, there is no need to override `login()`.
This is
[https://github.com/django/django/blob/fc266151648da8856dc735058375ed6cc0e636b5/tests/admin_views/customadmin.py#L13-L15
demonstrated by the test suite]:
{{{
class Admin2(admin.AdminSite):
...
login_form = forms.CustomAdminAuthenticationForm
}}}
And exercised by
[https://github.com/django/django/blob/fc266151648da8856dc735058375ed6cc0e636b5/tests/admin_views/tests.py#L1301
`tests.admin_views.tests.CustomModelAdminTest.test_custom_admin_site_login_form()`].
This was introduced in cc64fb5c4b4315a4ad66e21458e27ece57266847 for #8342,
which was part of Django v1.3.
If you can provide information demonstrating an issue here we can reassess
but pending that I'm going to close.
--
Ticket URL: <https://code.djangoproject.com/ticket/29508#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/069.5170ef2aa75a69e406349cd9272d765e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.