Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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() 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #user #group #template #tag #django
ADD COMMENT
Topic
Name
6+2 =