I am coding a model in Django.
I am using the User model from django.contrib.auth.models
I need to create a teacher entity and student entity.
They are basically the same - they all required username, password, email except for student type = 'student' and type = 'teacher'
How can I represent the Teacher and Student models?
Should I be extending User model for both the teacher and student?
or should I just create one model extending from the User model that just has a different type for student and teacher.
user = models.OneToOneField(User)
salary = models.FloatField()
grade = models.FloatField()
There is nothing wrong with what you have, it's a valid patten: please read this tho: http://charlesleifer.com/blog/django-patterns-model-inheritance/ it's a good read and explains Model Inheritance in more detail. Read on multi-table inheritance and abstract models too.