Am Planning to use inbuild Django permissions & groups.
I have a couple of more questions
- Am using a decorator with permission, my requirement is I need to add permission decorators for each view function and that should get logged-in user groups & check what are all permissions associated with that groups, but the below code @ permission_required will do I believe it checks only permissions assigned to users not from group permissions correct? if so do I need to write custom decorator?
suggest me some idea.
from django.contrib.auth.decorators import permission_required
@permission_required("demo.add_users")
def my_view(request):
pass
- the same question for UI template, to show form based on permissions, is it tied up with user permission or group permission
I need only group permission
{% if perms.foo.add_vote %}
do i need to write custom context processed for the logic
check based on logged in user groups and check the group permissions associated and show the form in UI
- and also check permission by user permission or group permission
request.user.has_perm("blog.set_published_status")
suggest some standard way
Thanks!