Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27133 closed Cleanup/optimization (fixed)

Explain how to load initial data with a data migration

Reported by: Vaibhav Tulsyan Owned by: Krzysztof Żuraw
Component: Documentation Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django 1.8's documentation states that fixtures are deprecated for loading initial data to models. However, Django 1.10 doesn't state anything about the deprecation.
Can more clarity be given on as to how initial data should ideally be loaded into models?

Links:
1.10: https://docs.djangoproject.com/en/1.10/howto/initial-data/
1.8: https://docs.djangoproject.com/en/1.8/howto/initial-data/

Change History (8)

comment:1 by Tim Graham, 8 years ago

Component: MigrationsDocumentation
Type: UncategorizedCleanup/optimization

Is the deprecation note and the explanation in the 1.7 release notes unclear?

If an application uses migrations, there is no automatic loading of fixtures. Since migrations will be required for applications in Django 1.9, this behavior is considered deprecated. If you want to load initial data for an app, consider doing it in a data migration.

initial_data fixtures are no longer loaded for apps with migrations; if you want to load initial data for an app, we suggest you create a migration for your application and define a RunPython or RunSQL operation in the operations section of the migration.

manage.py loaddata <fixturename> still works fine but it doesn't happen automatically. #24778 is a ticket about possibly allowing migrations to load fixtures.

Maybe you could propose a documentation clarification as I'm not exactly sure what would be helpful to clarify your doubt.

comment:2 by Tim Graham, 8 years ago

Summary: Are fixtures deprecated?Explain how to load initial data with a data migration
Triage Stage: UnreviewedAccepted

comment:3 by Krzysztof Żuraw, 8 years ago

Owner: changed from nobody to Krzysztof Żuraw
Status: newassigned

comment:4 by Krzysztof Żuraw, 8 years ago

Has patch: set
Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham, 8 years ago

Triage Stage: Ready for checkinAccepted

Hi, you shouldn't mark your own patch "Ready for Checkin", rather a separate reviewer should do that.

comment:6 by Marysia Lowas-Rzechonek, 8 years ago

Triage Stage: AcceptedReady for checkin

Reviewed - it looks fine.

comment:7 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In eaa6ea2f:

Fixed #27133 -- Doc'd how to provide initial data with migrations.

comment:8 by Tim Graham <timograham@…>, 8 years ago

In 07db0e0:

[1.10.x] Fixed #27133 -- Doc'd how to provide initial data with migrations.

Backport of eaa6ea2f37509f2e54de5268f32469deeff89eb9 from master

Note: See TracTickets for help on using tickets.
Back to Top