In django (v1.9) is there a way to set a field that is defined in the base class to use a different default value in the different descendant classes?
class Base(models.Model):
OBJ_TYPES = (
('type_a', 'Type A'),
('type_b', 'Type B'),
('type_c', 'Type C'),
('type_d', 'Type D'),
)
obj_type = models.CharField(choices=OBJ_TYPES, default='type_a')
class GenericChild(Base):
# obj_type defaults to type_a
pass
class TypeDChild(Base)
# Want obj_type to default to type_d
# This causes error (local field clashes...)
obj_type = models.CharField(choices=OBJ_TYPES, default='type_d')