Opened 14 years ago
Closed 14 years ago
#15964 closed Bug (fixed)
Do not order admin actions by description
Reported by: | Julien Phalip | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm currently dealing with a site where the admin user needs to follow a step-by-step process:
- Mark selected translations' status as "New"
- Mark selected translations' status as "Needs translation"
- Mark selected translations' status as "No translation needed"
- Mark selected translations' status as "In progress"
- Mark selected translations' status as "Ready for review"
- Mark selected translations' status as "Approved"
Therefore I've logically done the following:
class MyModelAdmin(ModelAdmin): actions = [mark_new, mark_needs_translation, mark_no_translation_needed, mark_in_progress, mark_ready_for_review, mark_approved] ...
But unfortunately the actions are automatically alphabetically ordered by description in the admin interface, i.e.:
- Mark selected translations' status as "Approved"
- Mark selected translations' status as "In progress"
- Mark selected translations' status as "Needs translation"
- Mark selected translations' status as "New"
- Mark selected translations' status as "No translation needed"
- Mark selected translations' status as "Ready for review"
This is not only confusing but also quite inflexible. I think the developers should be responsible for controlling the ordering of actions, similarly as they can control the ordering of list_display
or list_filter
fields.
This current behaviour doesn't seem to even be tested. Apparently the action's short_description
behaviour isn't tested either. The attached patch rectifies this behaviour and adds tests to cover all this.
Attachments (2)
Change History (5)
by , 14 years ago
Attachment: | 15964.admin-actions-ordering.diff added |
---|
by , 14 years ago
Attachment: | 15964.admin-actions-ordering.2.diff added |
---|
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Added reference to ticket number in the tests