Opened 4 years ago

Closed 4 years ago

#12775 closed (fixed)

Enable `dumpdata --exclude app_label.model`

Reported by: emulbreh Owned by: nobody
Component: Core (Serialization) Version: master
Severity: Keywords: dumpdata exclude
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Currently, dumpdata can only exclude whole apps. It would be useful if it supported exclusion of indiviual models with --exclude app_label.model.

Attachments (1)

django-12775.diff (11.2 KB) - added by Joshua Ginsberg <jag@…> 4 years ago.
Add exclude model support, unit tests, update docs

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by Alex

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

comment:2 Changed 4 years ago by SmileyChris

Specifically, this would be useful for excluding auto-generated permissions while still allowing auth.User to be serialized.

Changed 4 years ago by Joshua Ginsberg <jag@…>

Add exclude model support, unit tests, update docs

comment:3 Changed 4 years ago by Joshua Ginsberg <jag@…>

  • Has patch set

Pretty straightforward.

comment:4 Changed 4 years ago by Goldan

Thanks for a great patch, works perfectly! And as SmileyChris pointed, it is especially useful for dumping/loading data, since it enables dumping omitting only the contenttypes app and the auth.Permission model, and in combination with natural keys it makes it possible to fully automate dumping/loading procedure.

comment:5 Changed 4 years ago by DrMeers

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 4 years ago by russellm

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

(In [13511]) Fixed #12775 -- Modified the --exclude argument to dumpdata to allow exclusion of individual models. Thanks to emulbreh for the suggestion, and Joshua Ginsberg for the patch.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.