Opened 5 years ago

Closed 5 years ago

#22520 closed Uncategorized (duplicate)

CircularDependencyError when there's a foreign key to a model with PermissionsMixin

Reported by: Richard Eames Owned by: nobody
Component: Migrations Version: 1.7-beta-2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have the following models in my project. Running makemigration works, but running migrate causes a CircularDependencyError.

from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.db import models

class Employee(AbstractBaseUser, PermissionsMixin):
        USERNAME_FIELD = 'id'

class ModelA(models.Model):
        person = models.ForeignKey(Employee, blank = True, null = True, default = None)

I think this could be related to #22485 and/or #21968 but I'm not sure.
Test project attached.

Attachments (1)

circular.tar.gz (186.5 KB) - added by Richard Eames 5 years ago.
Minimal test project

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by Richard Eames

Attachment: circular.tar.gz added

Minimal test project

comment:1 Changed 5 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

It seems like it's probably a duplicate of #22325.

Note: See TracTickets for help on using tickets.
Back to Top