Skip to content Skip to sidebar Skip to footer

Django Group Permission Check In Template

I want to check group have permission in template for loop. My Context Processors from django.contrib.auth.models import User,Group,Permission from django.db.models import Q def us

Solution 1:

Group permissions are in, well, permissions:

From the docs

permissions

Many-to-many field to Permission:

So you could just do:

{% if permission ingroup.permissions.all  %} checked="checked" {% endif %}

Post a Comment for "Django Group Permission Check In Template"