Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7254 closed (fixed)

patch: exclude apps from dumpdir

Reported by: Carl Karsten <carl@…> Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Keywords:
Cc: "Russell, Keith-Magee", <freakboy3742@…> Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


To help deal with loaddata issues caused by a single app (like ) this adds support for --exclude to dumpdata. (use multiple --exclude to exclude multiple apps.)

It also adds --verbosity which shows lets you see what apps have been excluded, what will be processed, and what is being processed as the data is being dumped. It sends this to stderr because dumpdata currently sends to stdout.

If stderr is poor form, I was considering adding a --file option so that sdtout could be used for verbosity messages. but that seemed just as wrong as stderr, and stderr was much easier to code.

Attachments (2) (3.5 KB) - added by Carl Karsten <carl@…> 6 years ago. (3.3 KB) - added by Carl Karsten <carl@…> 6 years ago.
removed unnecessary changes, s/print stderr/sys.stderr.write

Download all attachments as: .zip

Change History (9)

Changed 6 years ago by Carl Karsten <carl@…>

comment:1 Changed 6 years ago by toxik

  • Patch needs improvement set

There are unnecessary changes in the patch. Please have them removed.

     option_list = BaseCommand.option_list + (
-        make_option('--format', default='json', dest='format',
+        make_option('--format', dest='format', default='json',
             help='Specifies the output serialization format for fixtures.'),
-        make_option('--indent', default=None, dest='indent', type='int',
+        make_option('--indent', dest='indent', type='int', default=None,
             help='Specifies the indent level to use when pretty-printing output'),

Also, the direct usage of stderr is layer violation, AFAICT.

Changed 6 years ago by Carl Karsten <carl@…>

removed unnecessary changes, s/print stderr/sys.stderr.write

comment:2 Changed 6 years ago by programmerq

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 6 years ago by Carl Karsten <carl@…>

  • Cc "Russell, Keith-Magee", <freakboy3742@…> added

Russ - you kinda mentored me on this - mind chiming in?

comment:4 Changed 6 years ago by russellm

  • Triage Stage changed from Design decision needed to Accepted

This is a reasonable idea, especially as a workaround for #7052 issues. I can't review the patch right now, but I should have a chance in the near future.

comment:5 Changed 6 years ago by russellm

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

(In [7615]) Fixed #7254 -- Added an '--exclude' option to dumpdata, allowing specific applications to be removed from the dump output. Thanks to Carl Karsten for the idea and patch.

comment:6 Changed 6 years ago by Carl Karsten <carl@…>

What happened to

make_option('-v', '--verbosity', action='store', dest='verbosity', default='0',


comment:7 Changed 6 years ago by russellm

On looking at the patch, I couldn't see the value in the output being provided by verbosity - it was useful output for debugging the command itself, but I didn't see the value for end users.

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.