mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #21969: Fix behaviour of initial_data with migrated apps
This commit is contained in:
@@ -59,6 +59,9 @@ but a few of the key features are:
|
||||
will still work, but that method name is deprecated and you should change
|
||||
it as soon as possible (nothing more than renaming is required).
|
||||
|
||||
* ``initial_data`` fixtures are no longer loaded for apps with migrations; if
|
||||
you want to load initial data for an app, we suggest you do it in a migration.
|
||||
|
||||
App-loading refactor
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -714,6 +717,19 @@ For apps with migrations, ``allow_migrate`` will now get passed
|
||||
without custom attributes, methods or managers. Make sure your ``allow_migrate``
|
||||
methods are only referring to fields or other items in ``model._meta``.
|
||||
|
||||
initial_data
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Apps with migrations will not load ``initial_data`` fixtures when they have
|
||||
finished migrating. Apps without migrations will continue to load these fixtures
|
||||
during the phase of ``migrate`` which emulates the old ``syncdb`` behaviour,
|
||||
but any new apps will not have this support.
|
||||
|
||||
Instead, you are encouraged to load initial data in migrations if you need it
|
||||
(using the ``RunPython`` operation and your model classes);
|
||||
this has the added advantage that your initial data will not need updating
|
||||
every time you change the schema.
|
||||
|
||||
App-loading changes
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user