예제 #1
0
 def set_owners(instance: Model, owners: List[int]):
     owner_objs = list()
     if g.user.id not in owners:
         owners.append(g.user.id)
     for owner_id in owners:
         user = current_app.appbuilder.get_session.query(
             current_app.appbuilder.sm.user_model).get(owner_id)
         owner_objs.append(user)
     instance.owners = owner_objs
예제 #2
0
 def set_owners(instance: Model, owners: List[int]) -> None:
     owner_objs = []
     user_id = get_user_id()
     if user_id and user_id not in owners:
         owners.append(user_id)
     for owner_id in owners:
         user = current_app.appbuilder.get_session.query(
             current_app.appbuilder.sm.user_model).get(owner_id)
         owner_objs.append(user)
     instance.owners = owner_objs