Opened 12 years ago

Closed 8 years ago

#20468 closed New feature (fixed)

Allow loaddata to exclude some apps or models

Reported by: Wojciech Banaś Owned by: Alex Morozov
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: berker.peksag@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Would propose adding this option to the command loaddata:

  -e EXCLUDE, --exclude=EXCLUDE
                        An appname or appname.ModelName to exclude (use
                        multiple --exclude to exclude multiple apps/models).

Sometimes it can be useful if you have a file with data from multiple applications / models, and we want to import only a portion of the data.

Change History (11)

comment:1 by Anssi Kääriäinen, 12 years ago

Triage Stage: UnreviewedAccepted

I am going to mark this accepted. I don't feel strongly in one way or another about this issue, I just want to get this out of unreviewed triage stage.

comment:2 by Alex Morozov, 9 years ago

Owner: changed from nobody to Alex Morozov
Status: newassigned

Seems useful. Recently I've faced a similar problem. Will give it a try.

comment:4 by Alex Morozov, 9 years ago

Guys, I've got a somewhat meta question: Shall I always squash my minor fixes to PR and push --force them, or shall I leave them as separate commits? Which way is the preferred one?

comment:5 by Tim Graham, 9 years ago

If it's a huge PR, incremental commits can make follow up review easier. In this case, the patch looks small enough that you could squash right away.

comment:6 by Alex Morozov, 9 years ago

Thank you, @timgraham. I've pushed the updated (and squashed) PR. All lights are green. It'd be nice if you review the code. I'm not sure about the source argument. Looks clumsy, but I haven't thought out another way of keeping the output compatibility. Is that OK?

comment:7 by Berker Peksag, 9 years ago

Cc: berker.peksag@… added
Patch needs improvement: set

I left some review comments on GitHub.

comment:8 by Tim Graham, 9 years ago

Patch needs improvement: unset

comment:9 by Tim Graham, 9 years ago

Patch needs improvement: set

Left a few more comments and branch needs a rebase to merge cleanly.

comment:10 by Tim Graham, 8 years ago

Patch needs improvement: unset
Summary: loaddata - during import exclude some applicationsAllow loaddata to exclude some apps or models

Updated PR from Berker.

comment:11 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In ae2a7da8:

Fixed #20468 -- Added loaddata --exclude option.

Thanks Alex Morozov for the initial patch.

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