Let's say I have an app that has 3 kinds of user
- Employee with fields like
work_number,departmentetc. - Member with fields like
phone_number, ..... - Agent with fields like
company_name,.....
They're different.
I write models like this:
class Employee(models.Model): user = models.OneToOneField(User) department = models.CharField(max_length=100) ....... class Member(models.Model): user = models.OneToOneField(User) ....... class Agent(models.Model): user = models.OneToOneField(User) ....... Now I can :
u = User.objects.get(username='xxxx') u.employee // it works... but, ONE user has THREE profiles (employee,member,agent) !!!
It's not matches my business, the business role is ONE user could be and must be only one kind of 3 profiles.
What's the best way to solve this?