Date created: Tuesday, October 17, 2023 2:01:46 PM. Last modified: Tuesday, January 16, 2024 3:31:48 PM
Django Notes
Erase database/fixtures:
python manage.py flush
Export fixtures (fixtures are loaded from the "fixtures" folder in any app):
# Export to stdout
python manage.py dumpdata --format yaml --indent 2 users
# Export to file
python manage.py dumpdata --format yaml --indent 2 -o user-dump.yaml users
# Export sub-models
python manage.py dumpdata --format yaml --indent 2 -o user-dump.yaml users.addresses
# Export fixture from a sub-model with a specific key:
python manage.py dumpdata --format yaml --indent 2 -o user-dump.yaml --pks 222,223,224 users.addresses
Previous page: Check Multicast MAC
Next page: Jinja2 Rendering