I have several models that have common functionality. Each model is a physically populated type of element, so they share things like stock, and also share some things, such as low inventory warnings (sends an email).
Instead of duplicating the code, I wrote an abstract model and inherited it.
class LowStockModel(models.Model):
stock = stock = models.IntegerField()
out_of_stock_behaviour = models.CharField(max_length=20, choices=[...])
class Meta:
abstract = True
def save(self, *args, **kwargs):
super(self.__class__, self).save(*args, **kwargs)
if self.stock <= 0:
My problem is that I need to change the shortcut or add different ones help_textto the field stockin the child classes that I create. This is very important because the customer (and their staff) needs instructions for the devices. I tried to move around the child __init__, but I will not go anywhere.
tl; dr ?