'If an app has multiple models with the same field, whats the best practice for keeping things DRY?
For example, if I have 3 models that look like this:
class CallLog(models.Model):
lead_id = models.BigIntegerField("Lead ID")
# other fields
class EmailLog(models.Model):
lead_id = models.BigIntegerField("Lead ID")
# other fields
class TextLog(models.Model):
lead_id = models.BigIntegerField("Lead ID")
# other fields
Do I add lead_id to each model individually or is there a way to only type it once?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
