MCPcopy
hub / github.com/django/django / get_action_choices

Method get_action_choices

django/contrib/admin/options.py:1187–1214  ·  view source on GitHub ↗

Return a list of choices for use in a form object. Each choice is a tuple (name, description).

(
        self,
        request,
        default_choices=None,
        action_location=ActionLocation.CHANGE_LIST,
    )

Source from the content-addressed store, hash-verified

1185 return action.description % model_format_dict(self.opts)
1186
1187 def get_action_choices(
1188 self,
1189 request,
1190 default_choices=None,
1191 action_location=ActionLocation.CHANGE_LIST,
1192 ):
1193 """
1194 Return a list of choices for use in a form object. Each choice is a
1195 tuple (name, description).
1196 """
1197 if default_choices is None:
1198 default_choices = [("", get_blank_choice_label())]
1199 choices = [*default_choices]
1200 # RemovedInDjango70Warning: When the deprecation ends, replace with:
1201 # actions = self.get_actions(request, action_location=action_location)
1202 actions = self._get_actions_with_action_location(
1203 request, action_location=action_location
1204 )
1205 for action in actions.values():
1206 if isinstance(action, tuple):
1207 choice = (action[1], action[2] % model_format_dict(self.opts))
1208 else:
1209 choice = (
1210 action.name,
1211 self._get_choice_description(action, action_location),
1212 )
1213 choices.append(choice)
1214 return choices
1215
1216 def get_action(self, action, action_location=ActionLocation.CHANGE_LIST):
1217 """

Calls 6

get_blank_choice_labelFunction · 0.90
model_format_dictFunction · 0.90
valuesMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected