MCPcopy
hub / github.com/django/django / _get_base_actions

Method _get_base_actions

django/contrib/admin/options.py:1079–1107  ·  view source on GitHub ↗

Return the list of actions, prior to any request-based filtering.

(self, action_location=ActionLocation.CHANGE_LIST)

Source from the content-addressed store, hash-verified

1077 return capfirst(name.replace("_", " "))
1078
1079 def _get_base_actions(self, action_location=ActionLocation.CHANGE_LIST):
1080 """Return the list of actions, prior to any request-based filtering."""
1081 actions = []
1082 base_actions = (
1083 self.get_action(action, action_location) for action in self.actions or []
1084 )
1085 # get_action might have returned None, so filter any of those out.
1086 base_actions = [action for action in base_actions if action]
1087 base_action_names = {action.name for action in base_actions}
1088
1089 # Gather actions from the admin site first
1090 for name, func in self.admin_site.actions:
1091 if name in base_action_names:
1092 continue
1093 locations = getattr(func, "locations", [ActionLocation.CHANGE_LIST])
1094 if action_location not in locations:
1095 continue
1096 description = self._get_action_description(func, name)
1097 action = Action(
1098 func=func,
1099 name=name,
1100 description=description,
1101 plural_description=getattr(func, "plural_description", description),
1102 locations=locations,
1103 )
1104 actions.append(action)
1105 # Add actions from this ModelAdmin.
1106 actions.extend(base_actions)
1107 return actions
1108
1109 def _filter_actions_by_permissions(self, request, actions):
1110 """Filter out any actions that the user doesn't have access to."""

Callers 5

get_actionsMethod · 0.95
_check_actionsMethod · 0.80

Calls 5

get_actionMethod · 0.95
extendMethod · 0.80
ActionClass · 0.70
appendMethod · 0.45