我有沿着線的模型結構:覆蓋默認值字段
class Store(models.Model):
STORE_TYPE = (
('I', 'Ice Cream'),
('H', 'Hardware'),
)
retailer_type = models.CharField(max_length=10, choices=STORE_TYPE)
...
class HardwareStore(Store):
hammers_stocked = models.BooleanField()
我想通過默認當我創建一個五金店()對象來設置retailer_type至H。是否可以在HardwareStore類的此字段中設置默認值?
HardwareStore繼承自'Retailer'或'Store'? – danihp
對不起 - 它從Store繼承。編輯修復 – alan