django-polymorphic icon indicating copy to clipboard operation
django-polymorphic copied to clipboard

Is it a good idea to have the duplicate field names in child models?

Open viperfx opened this issue 6 years ago • 1 comments

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.

viperfx avatar Aug 24 '19 15:08 viperfx

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.

yodermk avatar Nov 04 '19 22:11 yodermk