__is_member.py 250 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
2
3
4
from django.contrib.auth.models import User


def is_member(group_name: str, user: User) -> bool:
5
6
7
8
9
10
    """
    Function to know if a user is part of a specific group.

    TODO unit test
    """
    return user.groups.filter(name=group_name).exists()