Миксины вызывают взрыв при миграции

Миксины:

class ExamPartMixin(models.Model):
    exam_part = models.ForeignKey('exam_parts.ExamPart',
                                  null=True,
                                  on_delete=models.CASCADE,
                                  )


class NameMixin(models.Model):

    name = models.CharField(max_length=255,
                            null=False,
                            default="")

    def __str__(self):
        return self.name

    class Meta:
        abstract = True

Модель:

class ExamSection(NameMixin,
                  ExamPartMixin,
                  CommentMixin):

    class Meta:
        constraints = [
            models.UniqueConstraint(
                fields=['exam_part', 'name'], name='part_section')
        ]

Проблема миграции wnem

exam_sections.ExamSection: (models.E016) 'constraints' refers to field 'exam_part' which is not local to model 'ExamSection'.
    HINT: This issue may be caused by multi-table inheritance.
task_descriptions.TaskDescription: (models.E016) 'constraints' refers to field 'exam_part' which is not local to model 'TaskDescription'.
    HINT: This issue may be caused by multi-table inheritance.

Можете ли вы мне помочь? Должен ли я воздержаться от использования миксинов здесь? Мне нравятся миксины, и я хотел бы их использовать.

Вернуться на верх