﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23360	CircularDependencyError with AUTH_USER_MODEL set	Brian May	nobody	"Hello,

I am trying to get django-guardian working with Django 1.7, and I keep getting this error:

{{{
$ python setup.py test
...
django.db.migrations.graph.CircularDependencyError: [('admin', u'0001_initial'), ('testapp', u'0001_initial'), (u'admin', u'0001_initial')]
}}}

As far as I can tell, this is absolutely correct, there is a circular loop, only I don't know what to do about it. testapp/models.py contains:

{{{
    from django.contrib.auth.models import AbstractUser
    class CustomUser(AbstractUser, GuardianUserMixin):
        custom_id = models.AutoField(primary_key=True)
}}}

settings.py contains:

{{{
AUTH_USER_MODEL = ""testapp.CustomUser""
}}}

This results in a migration that contains:

{{{
    dependencies = [
        ('auth', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('admin', '0001_initial'),
    ]
}}}

If I understand correctly, testapp depends on auth because it uses AbstractUser which requires Group.

I am not sure I understand why the auth app depends on testapp.


Very experimental source with some other Django 1.7 fixes is available here:
https://github.com/brianmay/django-guardian/tree/patched

Thanks"	Uncategorized	closed	Migrations	1.7-rc-3	Normal	invalid		info@…	Unreviewed	0	0	0	0	0	0
