Answers for "check if user belongs to a group in template djanog"

1

user group template tag django

from django import template

register = template.Library() 

@register.filter(name='has_group') 
def has_group(user, group_name):
    return user.groups.filter(name=group_name).exists()
Posted by: Guest on May-05-2020

Code answers related to "check if user belongs to a group in template djanog"

Python Answers by Framework

Browse Popular Code Answers by Language