django_baseline/__init__.py
def user_has_group(user, group, superuser_skip=True):
    """
    Check if a user is in a certaing group.
    By default, the check is skipped for superusers.
    """

    if user.is_superuser and superuser_skip:
        return True

    return user.groups.filter(name=group).exists()
def user_has_group(user, group, superuser_skip=True):
    """
    Check if a user is in a certaing group.
    By default, the check is skipped for superusers.
    """

    if user.is_superuser and superuser_skip:
        return True

    return user.groups.filter(name=group).exists()
Check if a user is in a certaing group.
    By default, the check is skipped for superusers.