mirror of https://github.com/django/django.git
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:
parent
6ff826e12e
commit
28e8c54d7d
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue