Modify

Ticket #827 (closed defect: wontfix)

Opened 3 years ago

Last modified 3 years ago

Because initial_data loads before all apps have migrated, can't use initial_data fixtures which contain references to other apps

Reported by: jim.dalton@… Owned by: andrew
Priority: major Milestone: 1.0
Component: migrations Version: 0.7.3
Keywords: Cc:

Description

This is similar to #372, but slightly different.

I have some initial data in one app that loads data for models in other apps. (While this may sound like a Very Bad Idea, the app in question is at the "project" level, and loads project-specific data (which varies from project to project) for several dependent apps). This works fine during test runs when not using South, since Django first creates the data tables and then loads the initial data.

In South, it appears (if I'm not mistaken) that the order is slightly different. It installs each app, and then loads initial data for that app. So when I run my tests, the initial data I'm trying to load is not working because the app for some of that data has not been migrated yet.

I'd consider this a defect since the behavior is different from what works in Django, but if there is a workaround or I'm missing something please do mention it.

Attachments

Change History

comment:1 Changed 3 years ago by andrew

  • Status changed from new to closed
  • Resolution set to wontfix
  • Milestone set to 1.0

There are some cases where South has to be different to Django, and this is one. In cases like this, we recommend that either you specify dependencies so that the app with the initial data gets migrated last, or that you keep the fixture separate and insert it manually once migrations are done.

Closing as WONTFIX, since this decision has been made before.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.