1
0
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:
Andrew Godwin
2014-02-09 12:22:29 +00:00
parent 250841017c
commit d5df7a0515
5 changed files with 48 additions and 2 deletions

View File

@@ -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
~~~~~~~~~~~~~~~~~~~