From 28e8c54d7d2800a8ac98cf646a9e074055bc1b1b Mon Sep 17 00:00:00 2001 From: Anton Danilchenko Date: Wed, 11 Mar 2015 12:12:14 +0200 Subject: [PATCH] Fixed #24467 -- Removed conditional inclusion of actions.js & prepopulate.js. The JavaScript may be required when using ModelAdmin.get_actions() or get_prepopulated_fields(). Always including them is the easiest solution. --- django/contrib/admin/options.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 2b1f5125b5..c8f051a559 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -574,12 +574,11 @@ class ModelAdmin(BaseModelAdmin): 'core.js', 'admin/RelatedObjectLookups.js', 'jquery%s.js' % extra, - 'jquery.init.js' + 'jquery.init.js', + 'actions%s.js' % extra, + 'urlify.js', + 'prepopulate%s.js' % extra, ] - if self.actions is not None: - js.append('actions%s.js' % extra) - if self.prepopulated_fields: - js.extend(['urlify.js', 'prepopulate%s.js' % extra]) return forms.Media(js=[static('admin/js/%s' % url) for url in js]) def get_model_perms(self, request): @@ -1751,8 +1750,6 @@ class InlineModelAdmin(BaseModelAdmin): def media(self): extra = '' if settings.DEBUG else '.min' js = ['jquery%s.js' % extra, 'jquery.init.js', 'inlines%s.js' % extra] - if self.prepopulated_fields: - js.extend(['urlify.js', 'prepopulate%s.js' % extra]) if self.filter_vertical or self.filter_horizontal: js.extend(['SelectBox.js', 'SelectFilter2.js']) return forms.Media(js=[static('admin/js/%s' % url) for url in js])