(name, label)
return role
Find existing role or create new role
Find existing role or create new role
Find existing role or create new role
def find_or_create_role(name, label):
    """ Find existing role or create new role """
    role = Role.query.filter(Role.name == name).first()
    if not role:
        role = Role(name=name, label=label)
        db.session.add(role)
    return role
def find_or_create_role ( name , label ) : role = Role . query . filter ( Role . name == name ) . first ( ) if not role : role = Role ( name = name , label = label ) db . session . add ( role ) return role