Django-allauth Settings Update

This commit is contained in:
Maximilian 2025-06-07 20:21:51 +02:00
parent b860590127
commit 3f5d06098f
2 changed files with 20 additions and 11 deletions

View file

@ -6,5 +6,8 @@ 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
try:
group = Group.objects.get(name=group_name)
return group in user.groups.all()
except Group.DoesNotExist:
return False