Multiple User Types In Django

前端 未结 3 743
一生所求
一生所求 2021-01-15 09:34

I am new to Django and trying to create an App with two User Types (Freelancers and Customers). I understand how to create a User profile Class and it works well for me:

3条回答
  •  耶瑟儿~
    2021-01-15 10:06

    You Could Try extending the Default Django Auth User like this Create an App with Account or Whatever name you like , then in models.py write like below

    class User(AbstractUser):
        is_head = models.BooleanField(default=False)
        is_staff = models.BooleanField(default=False)
        is_public = models.BooleanField(default=False)
    

    Add Auth Extended Model in Settings.py

    AUTH_USER_MODEL = 'accounts.User'
    

    Migrate your Account app and you are all set with Your User Extended Model.

提交回复
热议问题