1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #29917 -- Stopped collecting ModelAdmin.actions from base ModelAdmins.

This commit is contained in:
Matthias Kestenholz
2018-11-10 00:52:30 +01:00
committed by Tim Graham
parent a375e911ef
commit f9ff1df1da
4 changed files with 46 additions and 11 deletions

View File

@@ -859,13 +859,8 @@ class ModelAdmin(BaseModelAdmin):
for (name, func) in self.admin_site.actions:
description = getattr(func, 'short_description', name.replace('_', ' '))
actions.append((func, name, description))
# Then gather them from the model admin and all parent classes,
# starting with self and working back up.
for klass in self.__class__.mro()[::-1]:
class_actions = getattr(klass, 'actions', []) or []
actions.extend(self.get_action(action) for action in class_actions)
# Add actions from this ModelAdmin.
actions.extend(self.get_action(action) for action in self.actions or [])
# get_action might have returned None, so filter any of those out.
return filter(None, actions)