def project_has_valid_admins(project, exclude_user=None):
 admin_memberships = project.memberships.filter(is_admin=True, user__is_active=True)
 if exclude_user:
  admin_memberships = admin_memberships.exclude(user=exclude_user)
 return (admin_memberships.count() > 0)

def project_has_valid_admins ( project , exclude_user = None ) : admin_memberships = project . memberships . filter ( is_admin = True , user__is_active = True ) if exclude_user : admin_memberships = admin_memberships . exclude ( user = exclude_user ) return ( admin_memberships . count ( ) > 0 )
checks if the project has any owner membership with a user different than the specified .