خرید بک لینک

Vote count: 0

I am here to get help of you. I need to implement a system with multiples types of users(e.g.. Doctor, Secretary, superuser), but I don't know the best way to make this. I am trying this way: I have created 2 models with a relation OneToOne to User, this models has specific infos according each type of user.

from django.contrib.auth.models import User
from django.db import models

class Doctor(models.Model):

     user = models.OneToOneField(User)
     ....


class Secretary(models.Model):

     user = models.OneToOneField(User)
     ....

So far so good, but I too need add new users by django admin, how Can I choose the type of user in django admin and to create this relation (add this infos according type of user) in time of creation of new user?

asked 3 mins ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 13 اسفند 1394 ساعت: 8:30

صفحه بندی