I have a main class with a category property and several subclasses. I would like to set a default category for each subclass. For instance:
class BaseAd(models.Model): CATEGORY_CHOICES = ((1, 'Zeta'), (2, 'Sigma'), (3, 'Omega'),) category = models.IntegerField(choices=CATEGORY_CHOICES) ... class SigmaAd(BaseAd): additional_prop = models.URLField() category = models.IntegerField(default=2, editable=False)
Of course, my example does not work due to FieldError. How can I override a property value? Or is it an admin feature that I should focus on?
source share