diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 707428b055..ea64d6e296 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -314,9 +314,12 @@ class AdminSite(object): request.current_app = self.name return password_change_done(request, **defaults) - def i18n_javascript(self, request): + def i18n_javascript(self, request, extra_context=None): """ Displays the i18n JavaScript that the Django admin requires. + + `extra_context` is unused but present for consistency with the other + admin views. """ return JavaScriptCatalog.as_view(packages=['django.contrib.admin'])(request) diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 57ded94e21..421d2ce25b 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -691,6 +691,10 @@ class AdminViewBasicTest(AdminViewBasicTestCase): response = self.client.get(reverse('admin:jsi18n')) self.assertContains(response, 'Choisir une heure') + def test_jsi18n_with_context(self): + response = self.client.get(reverse('admin-extra-context:jsi18n')) + self.assertEqual(response.status_code, 200) + def test_L10N_deactivated(self): """ Check if L10N is deactivated, the JavaScript i18n view doesn't diff --git a/tests/admin_views/urls.py b/tests/admin_views/urls.py index 926eca0a2d..ca9b165626 100644 --- a/tests/admin_views/urls.py +++ b/tests/admin_views/urls.py @@ -12,5 +12,7 @@ urlpatterns = [ url(r'^test_admin/admin4/', customadmin.simple_site.urls), url(r'^test_admin/admin5/', admin.site2.urls), url(r'^test_admin/admin7/', admin.site7.urls), + # All admin views accept `extra_context` to allow adding it like this: + url(r'^test_admin/admin8/', (admin.site.get_urls(), 'admin', 'admin-extra-context'), {'extra_context': {}}), url(r'^test_admin/has_permission_admin/', custom_has_permission_admin.site.urls), ]