def can_manage_group(cls, user, group):
        """
        Check user has permission to manage the given group
        :param user: User object to test permission of
        :param group: Group object the user is attempting to manage
        :return: True if the user can manage the group
        """
        if user.is_authenticated:
            return cls.has_management_permission(user) or user.leads_groups.filter(group=group).exists()
        return False
def can_manage_group ( cls , user , group ) : if user . is_authenticated : return cls . has_management_permission ( user ) or user . leads_groups . filter ( group = group ) . exists ( ) return False
Check user has permission to manage the given group
        :param user: User object to test permission of
        :param group: Group object the user is attempting to manage
        :return: True if the user can manage the group