Opened 2 years ago

Closed 2 years ago

#22520 closed Uncategorized (duplicate)

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

Reported by: Naddiseo 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 Naddiseo 2 years ago.
Minimal test project

Download all attachments as: .zip

Change History (2)

Changed 2 years ago by Naddiseo

Minimal test project

comment:1 Changed 2 years ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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

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