django_dumpdata, django_loaddata: new modules (#10726)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.16) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled

* django module, module_utils: adjustments

* more fixes

* more fixes

* further simplification

* django_dumpdata/django_loaddata: new modules

* Update plugins/modules/django_dumpdata.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* add note about idempotency

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2025-09-04 07:49:11 +12:00 committed by GitHub
commit d0123a1038
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 364 additions and 4 deletions

View file

@ -59,3 +59,24 @@ options:
type: str
default: default
"""
DATA = r"""
options:
excludes:
description:
- Applications or models to be excluded.
- Format must be either V(app_label) or V(app_label.ModelName).
type: list
elements: str
format:
description:
- Serialization format of the output data.
type: str
default: json
choices: [xml, json, jsonl, yaml]
notes:
- As it is now, the module is B(not idempotent). Ensuring idempotency for this case can be a bit tricky, because it would
amount to ensuring beforehand that all the data in the fixture file is already in the database, which is not a trivial feat.
Unfortunately, neither C(django loaddata) nor C(django dumpdata) have a C(--dry-run) option, so the only way to know whether
there is a change or not is to actually load or dump the data.
"""