I've an application that's been happily running for a few years, that does this:

class Person(Model):
   # everyone's a Person

class Researcher(Model):
    # a Researcher is Person who publishes research
    person = models.OneToOneField(Person)

class Publication(Model):
    author = models.ForeignKey(Researcher)


But this is no longer enough: now I also need to distinguish between 
Researchers who are research students and members of staff. Those who are 
students will need new fields such as "thesis_title" and "supervisors".

But, I will *still* need the Researcher class independently of the new 
ResearchStudent and ResearchStaff classes, because it's needed for 
Publication.author.

So now it might look something like this:

class Person(Model):
   # everyone's a Person

class Researcher(Model):
    # a Researcher is Person who publishes research
    person = models.OneToOneField(Person)

class ResearchStaff(Model):
   researcher = models.OneToOneField(Researcher)

class ResearchStudent(Model):
   researcher = models.OneToOneField(Researcher)
   supervisors = models.ManyToManyField(ResearchStaff)

class Publication(Model):
    author = models.ForeignKey(Researcher)


How manageable is this going to be? Is there a better way of doing what I need 
to do, perhaps through inheritance?

Thanks,

Daniele

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140526213320.1042853662%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.

Reply via email to