Skip to content

Conversation

@JohananOppongAmoateng
Copy link
Contributor

Add Comprehensive Fixture Support Documentation
Users reported difficulty using Django's loaddata command with polymorphic models. While the documentation mentioned using --natural-primary and --natural-foreign flags with dumpdata , there was no guidance on:

How to properly create fixtures for polymorphic models
How to load fixtures with loaddata
What to do if polymorphic_ctype
references are incorrect after loading
Solution
This PR adds comprehensive documentationfor fixture support with polymorphic models.

advanced.rst
Added new section "Working with Fixtures" with:

Creating fixtures with dumpdata --natural-primary --natural-foreign
Loading fixtures with loaddata
Using reset_polymorphic_ctype() utility to fix incorrect references
Example fixture JSON format with natural keys
Data migration example for fixing imported data

quickstart.rst
Enhanced the existing note about fixtures with:

Closes #513

@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.44%. Comparing base (0d30c86) to head (905600b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #791   +/-   ##
=======================================
  Coverage   83.44%   83.44%           
=======================================
  Files          26       26           
  Lines        1649     1649           
  Branches      264      264           
=======================================
  Hits         1376     1376           
  Misses        207      207           
  Partials       66       66           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fixtures

1 participant