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.
This commit is contained in:
Anton Danilchenko 2015-03-11 12:12:14 +02:00 committed by Tim Graham
parent 6ff826e12e
commit 28e8c54d7d
1 changed files with 4 additions and 7 deletions

View File

@ -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])