django-polymorphic
django-polymorphic copied to clipboard
Is it a good idea to have the duplicate field names in child models?
class Organisation(PolymorphicModel):
name = models.CharField(max_length=255)
class NationalNode(Organisation):
email = models.CharField(max_length=255)
class PatientNode(Organisation):
email = models.CharField(max_length=255)
Is there any issues that can happen with this type of setup?
Note: The email field may not be present in all child models.
Not the module author (and just getting started using it myself), but I don't see why that wouldn't work, just that you wouldn't be able to query for email across different sub-models. If it is in most instances, though, it might be better to include it in the base model but nullable. Kind of depends on how you intend to query it.