Multiple User Types In Django

前端 未结 3 714
一生所求
一生所求 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 09:55

    You should need just use Groups Django mechanism - you need to create two groups freelancer and let say common and check whether user is in first or second group - then show him appropriate view

    To check whether user is in group you can use

    User.objects.filter(pk=userId, groups__name='freelancer').exists()
    

提交回复
热议问题