Fixed #23993 -- Added form.media to the admin login template.
This commit is contained in:
parent
ec808e807a
commit
88c605e3e3
|
@ -1,7 +1,9 @@
|
||||||
{% extends "admin/base_site.html" %}
|
{% extends "admin/base_site.html" %}
|
||||||
{% load i18n admin_static %}
|
{% load i18n admin_static %}
|
||||||
|
|
||||||
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}" />{% endblock %}
|
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}" />
|
||||||
|
{{ form.media }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block bodyclass %}{{ block.super }} login{% endblock %}
|
{% block bodyclass %}{{ block.super }} login{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ from django.contrib.admin.forms import AdminAuthenticationForm
|
||||||
|
|
||||||
class CustomAdminAuthenticationForm(AdminAuthenticationForm):
|
class CustomAdminAuthenticationForm(AdminAuthenticationForm):
|
||||||
|
|
||||||
|
class Media:
|
||||||
|
css = {'all': ('path/to/media.css',)}
|
||||||
|
|
||||||
def clean_username(self):
|
def clean_username(self):
|
||||||
username = self.cleaned_data.get('username')
|
username = self.cleaned_data.get('username')
|
||||||
if username == 'customform':
|
if username == 'customform':
|
||||||
|
|
|
@ -1182,6 +1182,7 @@ class CustomModelAdminTest(AdminViewBasicTestCase):
|
||||||
self.assertIsInstance(login, TemplateResponse)
|
self.assertIsInstance(login, TemplateResponse)
|
||||||
self.assertEqual(login.status_code, 200)
|
self.assertEqual(login.status_code, 200)
|
||||||
self.assertContains(login, 'custom form error')
|
self.assertContains(login, 'custom form error')
|
||||||
|
self.assertContains(login, 'path/to/media.css')
|
||||||
|
|
||||||
def test_custom_admin_site_login_template(self):
|
def test_custom_admin_site_login_template(self):
|
||||||
self.client.logout()
|
self.client.logout()
|
||||||
|
|
Loading…
Reference in New Issue