loading initial fixture of an app before another
Hi,
I have initial fixtures (initial_data.json) for several apps.
The model A of App1 references the model B of App2.
I use natural keys to reference it.
So when I sync the DB, Django tries to make a query on modelB.
However, it appears that the fixtures of my App1 are installed before the fixtures of my App2.
It then fails because it cannot get the modelB.
I would like the contrary: to install fixtures from App2 before.
I tried a natural_key.dependencies on the naturel_key method of the model A in my App1 but it does not work. (https://docs.djangoproject.com/en/dev/topics/serialization/#dependencies-during-serialization)
def natural_key(self):
return (self.url,)
natural_key.dependencies = ['app2.modelB']
Any idea?
Thanks
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ekI6Gy4r87MJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home