Overwrite Django model __init__ method
问题 The Ingredient model of my Django project has an IntegerField which declares if this ingredient stock is managed by weight, units, or litters. Although the database has its integer value I have to display its name. And instead of looping over every ingredient and setting its value, I thought it was better to overwrite the __init__ method of the Python class, but I don't get how. models.py: class Ingredient(models.Model): def __init__(self): super(Ingredient, self).__init__() if self.cost_by =