[Django] #37195: Add --exclude-system option to dumpdata to skip Django-managed models

3 views
Skip to first unread message

Django

unread,
Jun 28, 2026, 3:58:46 PM (2 days ago) Jun 28
to django-...@googlegroups.com
#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.

Django

unread,
Jun 28, 2026, 6:54:38 PM (2 days ago) Jun 28
to django-...@googlegroups.com
#37195: Add --exclude-system option to dumpdata to skip Django-managed models
-------------------------------------+-------------------------------------
Reporter: abdullah | Owner: (none)
Type: New feature | Status: closed
Component: Core (Management | Version: 6.0
commands) |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* resolution: => wontfix
* status: new => closed

Comment:

Thanks for raising the issue, however, I think that since the list of
excluded models is likely to vary from project to project, I would
recommend to simply create a custom management command that meets your
requirements. With AI, such a command can be created trivially and you
won't be bound to Django's slow release cycle.
--
Ticket URL: <https://code.djangoproject.com/ticket/37195#comment:1>
Reply all
Reply to author
Forward
0 new messages