What is the best way to design a multiple level user login system using django and postgresql. The user details are head(Admin), students, teachers,staffs etc. These different types of user details have different fields and we can't alter that fields. How we design user model by combining all these type of users.
class Heads(models.Model):
gid = models.IntegerField(primary_key=True)
name = models.CharField(max_length=50)
emp_code= models.CharField(max_length=50)
school = models.ForeignKey(SchoolDetails)
prdFrom = models.DateField()
contact_no=models.CharField(max_length=50)
email_id=models.CharField(max_length=50)
designation=models.CharField(max_length=50)
address =models.TextField()
def __unicode__(self):
return unicode(self.name)
class Meta:
db_table = u'heads'
verbose_name = "heads"
class Student(models.Model):
gid = models.IntegerField(primary_key=True)
name = models.CharField(max_length=50)
stud_code= models.CharField(max_length=50)
school = models.ForeignKey(SchoolDetails)
std = models.IntegerField()
division=models.CharField()
parents_email_id=models.CharField(max_length=50)
parents_contact_no=models.CharField(max_length=50)
addess =models.TextField()
def __unicode__(self):
return unicode(self.name)
class Meta:
db_table = u'students'
verbose_name = "students"
class Teacher(models.Model):
gid = models.IntegerField(primary_key=True)
name = models.CharField(max_length=50)
emp_code= models.CharField(max_length=50)
school = models.ForeignKey(SchoolDetails)
contact_no=models.CharField(max_length=50)
email_id=models.CharField(max_length=50)
address =models.TextField()
is_lead= models.CharField()
def __unicode__(self):
return unicode(self.name)
class Meta:
db_table = u'teacher'
verbose_name = "teacher"
class Staff(models.Model):
gid = models.IntegerField(primary_key=True)
name = models.CharField(max_length=50)
emp_code= models.CharField(max_length=50)
school = models.ForeignKey(SchoolDetails)
contact_no=models.CharField(max_length=50)
email_id=models.CharField(max_length=50)
address =models.TextField()
designation= models.CharField()
def __unicode__(self):
return unicode(self.name)
class Meta:
db_table = u'staff'
verbose_name = "staff"
Please give answers.
Thank You.