Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#10595 closed (fixed)

Add the ability to set actions to None in order to avoid admin actions choices

Reported by: david Owned by: david
Component: contrib.admin Version: 1.0
Severity: Keywords: actions
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

After a discussion with Jacob on irc:

<david`bgk> is there a way to disable admin actions or my admin will never be the same? :)
<jacobkm> david`bgk: that's a good point; actions = None should Do The Right Think.
<jacobkm> david`bgk: file a bug!
<david`bgk> jacobkm, no it must be an empty list
<jacobkm> david`bgk: no, I'm saying that we should modify actions so that "actions = None" means "don't put any actions on this page"
<jacobkm> won't be in the beta, but we can consider it a bug and fix it for the final release.

I'll try to submit a patch quickly.

Attachments (2)

patch_django_10595.20090324.diff (3.0 KB) - added by david 6 years ago.
First try
patch_django_10595.20090324-2.diff (5.4 KB) - added by david 6 years ago.
Now with documentation and tests

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by jacob

  • milestone changed from 1.1 beta to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 6 years ago by david

First try

comment:2 Changed 6 years ago by david

  • Has patch set
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement set

Changed 6 years ago by david

Now with documentation and tests

comment:3 Changed 6 years ago by david

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:4 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

(In [10408]) Made a bunch of improvements to admin actions. Be warned: this includes one minor but BACKWARDS-INCOMPATIBLE change.

These changes are:

  • BACKWARDS-INCOMPATIBLE CHANGE: action functions and action methods now share the same signature: (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 first modeladmin argument.
  • The delete selected action is now a standalone function registered site-wide; this makes disabling it easy.
  • Fixed #10596: there are now official, documented AdminSite APIs 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.
  • Fixed #10595: you can now disable actions for a particular ModelAdmin by setting actions to None.
  • Fixed #10734: actions are now sorted (by name).
  • Fixed #10618: the action is now taken from the form whose "submit" button you clicked, not arbitrarily the last form on the page.
  • All of the above is documented and tested.

comment:3 Changed 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top