Django model field unique among all subclasses

69 views Asked by At

I have the following model structure:

class A(models.Model):
    ...
    class Meta:
        abstract = True

class B(A):
    ctx_order = models.PositiveIntegerField(blank=False, null=False, default=1)

class C(A):
    ctx_order = models.PositiveIntegerField(blank=False, null=False, default=2)

I want to make sure that the ctx_order field is unique among all subclasses that inherit from A. Is there a way to accomplish that or would I have to do the validation myself?

0

There are 0 answers