From 88c605e3e34cebd5485d286a17ac84c7b8b0faf1 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 7 Mar 2015 11:57:52 +0100 Subject: [PATCH] Fixed #23993 -- Added form.media to the admin login template. --- django/contrib/admin/templates/admin/login.html | 4 +++- tests/admin_views/forms.py | 3 +++ tests/admin_views/tests.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html index 1268297e4b..b89aa50044 100644 --- a/django/contrib/admin/templates/admin/login.html +++ b/django/contrib/admin/templates/admin/login.html @@ -1,7 +1,9 @@ {% extends "admin/base_site.html" %} {% load i18n admin_static %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }} +{{ form.media }} +{% endblock %} {% block bodyclass %}{{ block.super }} login{% endblock %} diff --git a/tests/admin_views/forms.py b/tests/admin_views/forms.py index e8493df95b..06c99f4bc3 100644 --- a/tests/admin_views/forms.py +++ b/tests/admin_views/forms.py @@ -4,6 +4,9 @@ from django.contrib.admin.forms import AdminAuthenticationForm class CustomAdminAuthenticationForm(AdminAuthenticationForm): + class Media: + css = {'all': ('path/to/media.css',)} + def clean_username(self): username = self.cleaned_data.get('username') if username == 'customform': diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 3519f074db..391122ef07 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -1182,6 +1182,7 @@ class CustomModelAdminTest(AdminViewBasicTestCase): self.assertIsInstance(login, TemplateResponse) self.assertEqual(login.status_code, 200) self.assertContains(login, 'custom form error') + self.assertContains(login, 'path/to/media.css') def test_custom_admin_site_login_template(self): self.client.logout()