#10734 closed (fixed)
Admin actions: use SortedDict instead of dict for predictable actions order
| Reported by: | Mikhail Korobov | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | kmike84@… | Triage Stage: | Accepted |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I think the ability to define order of actions is a nice usability feature. The order of admin actions in drop-down menu now depends on internal python dict representation. If in get_actions function we use
actions = SortedDict()
instead of
actions = {}
actions wil have fixed order: the ones defined first will come on the top of the list. For example, if we define some custom actions using
actions=['action1', 'action2']
action1 will be before action2 in drop-down. For reverse order we will be able to write
actions=['action2', 'action1'].
Attachments (1)
Change History (4)
comment:1 by , 17 years ago
| milestone: | → 1.1 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
by , 17 years ago
| Attachment: | actions-sorted.diff added |
|---|
comment:2 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
(In [10408]) Made a bunch of improvements to admin actions. Be warned: this includes one minor but BACKWARDS-INCOMPATIBLE change.
These changes are:
(modeladmin, request, queryset). Actions defined as methods stay the same, but if you've defined an action as a standalone function you'll now need to add that firstmodeladminargument.AdminSiteAPIs for dealing with actions, including a method to disable global actions. You can still re-enable globally-disabled actions on a case-by-case basis.ModelAdminby settingactionstoNone.