#37195: Add --exclude-system option to dumpdata to skip Django-managed models
-------------------------------------+-------------------------------------
Reporter: abdullah | Type: New
| feature
Status: new | Component: Core
| (Management commands)
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Currently, when using `dumpdata` to export application data, users often
need to manually exclude Django-managed models such as content types,
permissions, admin logs, and sessions.
For example:
{{{
python manage.py dumpdata \
--exclude contenttypes \
--exclude auth.Permission \
--exclude admin.LogEntry \
--exclude sessions.Session
}}}
This is repetitive and easy to get wrong, especially across projects with
different INSTALLED_APPS.
Some of this data is environment-specific or regenerated by Django through
migrations and post-migrate handlers. Including it in fixtures can cause
conflicts or unwanted records when loading data into another database.
I would like to propose adding a convenience option to dumpdata, for
example:
{{{
python manage.py dumpdata --exclude-system
}}}
or possibly:
{{{
python manage.py dumpdata --exclude-internal
}}}
This option would exclude a predefined set of Django-managed/internal
models from serialization.
Possible candidates could include:
{{{
- contenttypes.ContentType
- auth.Permission
- admin.LogEntry
- sessions.Session
}}}
The exact list and option name can be discussed.
This would be backwards-compatible because the behavior would only apply
when the option is explicitly provided. Existing dumpdata behavior would
remain unchanged.
--
Ticket URL: <
https://code.djangoproject.com/ticket/37195>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.