Specify application dependency on migration

I am trying to add source data in Django 1.7, and I read that it is recommended to use data migration.

I correctly created a migration file called "0001_groups" in which I create several contrib.auth groups and permissions.

The problem is that it starts before the auth migration completes.

I found out what is called the last migration of the auth application and is called 0005_alter_user_last_login_null.py . So I tried:

 dependencies = [ ('auth', '0005_alter_user_last_login_null'), ] 

but I get:

KeyError: u "Migration appname.0001_groups dependent links nonexistent parent node ('auth', '0005_alter_user_last_login_null')"

I searched for this error and always refer to the corrected Django errors for 11 months.

How can I correctly determine the auth application dependency?

+5
source share
2 answers

You are using 1.7 , but look at the original master tree. See this and try 0001_initial .

+2
source

I found out that you can reference the last migration using __latest__ :

 dependencies = [ ('auth', '__latest__'), ] 
+12
source

Source: https://habr.com/ru/post/1201981/


All Articles