Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#14162 closed (fixed)

Dumpdata needs an option to use the base manager instead of the default manager

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

Description

Objects with custom managers sometimes filter results when dumpdata is run. Often we want to dump all the objects in our database, not just the subset of objects which are returned by the default manager.

The attached patch adds a --all option to the dumpdata command which makes it use Django's base manager instead of the default manager. This means that even objects which would normally be filtered by the default manager are returned.

Attachments (1)

dumpdata_change.diff (5.9 KB) - added by PaulM 5 years ago.
Patches dumpdata to use _base_manager if --all is set. Includes tests and docs. Fixes a stray comment.

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by PaulM

Patches dumpdata to use _base_manager if --all is set. Includes tests and docs. Fixes a stray comment.

comment:1 Changed 5 years ago by gabrielhurley

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

This patch looks good to me. It's got docs and tests, applies cleanly, respects multi-db, does something useful without cruft... I'll call this RFC until a core dev can take a look.

comment:2 Changed 5 years ago by lukeplant

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

(In [13669]) Fixed #14162 - Dumpdata needs an option to use the base manager instead of the default manager

Thanks to PaulM for suggestion and patch.

comment:3 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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