User Based role in Django

29 views
Skip to first unread message

Mannu Gupta

unread,
Jun 21, 2017, 3:45:13 AM6/21/17
to Django users
I want to make a role based user in Django like the following :- 

User with Subscription level 0 will have some feature and some basic fields like first name , last name etc. 
User with Subscription level 1 will have some more feature and some extra fields  like tax-id , national id , nationality, is_disable etc . 
User with Subscription level 2 will have more features with all the fields with the fields with same as fields of Subscription level 1 since he has already subscribed only he is upgrading.
User with Subscription level 3 will have more feature with all the fields with the fields same above .

How do i make the user model and related this relate to its role , and how do i be able to set permission for different user ?

Jani Tiainen

unread,
Jun 21, 2017, 4:12:08 AM6/21/17
to django...@googlegroups.com
Hi,

We have been using user groups for that. And then we check and filter out based on given group(s).

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4bdc5c54-5c90-4515-b977-30fcb612b3ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mannu Gupta

unread,
Jun 21, 2017, 4:15:02 AM6/21/17
to django...@googlegroups.com
Hi , 
Will I be able to trace if user upgrde the subscription level ?

Manni

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/2JjuGF1-4PU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Jani Tiainen

unread,
Jun 21, 2017, 4:18:48 AM6/21/17
to django...@googlegroups.com
Well its your code, so yes if you write code that does it.

It doesn't happen magically for you.

Mannu Gupta

unread,
Jun 21, 2017, 4:24:07 AM6/21/17
to django...@googlegroups.com
I meant that using your method i.e by making different groups .
When he upgrade the group .
How about making another table having user, his subscription level and changed_at field(which traces when he /upgrade the group )

Just want to know your suggestion .

Mannu

Jani Tiainen

unread,
Jun 21, 2017, 5:44:26 AM6/21/17
to django...@googlegroups.com
Hi,

User can't upgrade his group. It is your code that does it. And it is your code responsibility to track changes etc.

User just may have a button on ui that invokes your code (view) but rest is really up to you.

Reply all
Reply to author
Forward
0 new messages