Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#7973 closed (fixed)

Add 'exclude' option to BaseModelAdmin

Reported by: Julien Phalip Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: bthomas@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


ModelForm features an 'exclude' attribute which is great when you want to exclude only a few fields from the model's form. This has many advantages as it avoids specifying of all the fields that you *do* want to display, and if a field is later added to the model it will automatically be picked up in the form without having to explicitly add it again to the form's field list.

Unfortunately, ModelAdmin doesn't have that. It'd be great to have it, both for consistency and ease of use.

Attachments (1)

7973.exclude.diff (3.4 KB) - added by Julien Phalip 10 years ago.
patch + doc + tests

Download all attachments as: .zip

Change History (9)

comment:1 Changed 10 years ago by Julien Phalip

milestone: 1.0 beta
Summary: Add 'exclude' attribute to ModelAdminAdd 'exclude' declarative attribute to ModelAdmin

comment:2 Changed 10 years ago by Julien Phalip

Summary: Add 'exclude' declarative attribute to ModelAdminAdd 'exclude' option to BaseModelAdmin

'option' seems to be the correct term for this.

Changed 10 years ago by Julien Phalip

Attachment: 7973.exclude.diff added

patch + doc + tests

comment:3 Changed 10 years ago by Malcolm Tredinnick

milestone: 1.0 beta

This isn't 1.0-beta material. It could even be done after 1.0, since it should be fully backwards compatible.

comment:4 Changed 10 years ago by Eric Holscher

milestone: post-1.0
Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

comment:5 Changed 10 years ago by Bob Thomas

Cc: bthomas@… added
Needs documentation: unset
Needs tests: unset

Patch already includes tests and docs.

comment:6 Changed 10 years ago by Brian Rosner

milestone: post-1.01.0

comment:7 Changed 10 years ago by Brian Rosner

Resolution: fixed
Status: newclosed

(In [8861]) Fixed #7973 -- Added exclude to BaseModelAdmin to make everything consistent with the form/formset factories. Refs #8071 to make it easier to get at exclude. Thanks julien for the patch.

comment:6 Changed 7 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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