Having two models, parent and child, I want to set the value of one of the attributes the child inherits.
For example, in the following code the color attribute would be set when creating a RedCat object.
# Parent class
class Cat(models.Model):
name = models.CharField(max_length=10)
color = models.CharField(max_length=10)
class Meta:
abstract = True
# Child class
class RedCat(Cat):
color = 'red' # <-- Doesn't work!
I'm considering either overriding the parent attribute or having the attribute only on the children, but I wonder, is there a right/better way to set a default value in a Django model for an inherited attribute?