mirror of https://github.com/django/django.git
Fixed #26779 -- Added extra_context parameter to admin's i18n_javascript view.
This commit is contained in:
parent
2224a56631
commit
b0acb1e73e
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue