group check template tag
This commit is contained in:
parent
0fcec94275
commit
cc02b4126b
3 changed files with 34 additions and 20 deletions
0
app/export/templatetags/__init__.py
Normal file
0
app/export/templatetags/__init__.py
Normal file
9
app/export/templatetags/group_check.py
Normal file
9
app/export/templatetags/group_check.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django import template
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter(name='group_check')
|
||||
def has_group(user, group_name):
|
||||
group = Group.objects.get(name=group_name)
|
||||
return True if group in user.groups.all() else False
|
Loading…
Add table
Add a link
Reference in a new issue