I have in application_user
, (this is an import from a PHP application, hence 2 fields for groups, and role name for each role ID which is redundant) :
class User(AbstractUser):
groupA_user_designation_id = models.IntegerField(blank=False, null=True)
groupA_user_designation_name = models.CharField(max_length=250, blank=False, null=True)
groupB_user_designation_id = models.IntegerField(blank=False, null=True)
groupB_user_designation_name = models.CharField(max_length=250, blank=False, null=True)
With values in the database like :
0,None,3,Management
2,Admin,1,Super Admin
0,None,1,Super Admin
0,None,2,Admin
0,None,2,Admin
0,None,1,Super Admin
6,Sales Manager,2,Admin
4,Accounts,3,Management
6,Sales Manager,3,Management
0,None,3,Management
Now I want to assign views to these role IDs so that only users with assigned roles can only get access to the views in views.py.
How do I go about this in this scenario ?