class MyChoices(models.IntegerChoices):
CHOICE_A = 1
CHOICE_B = 2
class MyModelA(models.Model):
choice = models.IntegerField(choices=MyChoices.choices)
payload = models.CharField(...)
class MyModelB(models.Model):
models_a = models.ManyToManyRelationshipField(MyModelA, ...)
payload = models.CharField(...)
Можно ли создать таблицу UniqueConstraint
в app_my_model_b_my_model_a
с полем MyModelA.choice
и полем первичного ключа MyModelB
?