示例#1
0
 def add_applicant(cls, user_id, s_name):
     _old = School.query_one(School.s_name == s_name).s_applicants
     user = User.query_one(User.u_id == user_id)
     _new = {
         'u_id': user.u_id,
         'u_name': user.u_name,
         'u_email': user.u_email
     }
     data = basic.update_str_list(_old, _new)
     School.update(School.s_name == s_name, {School.s_applicants: data})
示例#2
0
 def add_teacher(cls, user_id, s_id):
     school = School.query_one(School.s_id == s_id)
     user = User.query_one(User.u_id == user_id)
     _new = {
         'u_id': user.u_id,
         'u_name': user.u_name,
         'u_email': user.u_email
     }
     teachers = basic.update_str_list(school.s_applicants, _new)
     applicants = basic.reduce_str_list(school.s_applicants, _new)
     School.update(School.s_id == s_id, {School.s_applicants: applicants})
     School.update(School.s_id == s_id, {School.s_teachers: teachers})
示例#3
0
 def bind_child(cls, child_email, parent_email):
     user = User.query_one(User.u_email == child_email)
     _child = dict(u_id=user.u_id, u_name=user.u_name, u_pic=user.u_pic)
     _own = basic.update_str_list(user.u_own, _child)
     User.update(User.u_email == parent_email, {User.u_own: _own})
示例#4
0
 def star(cls, u_email, _new):
     user = User.query_one(User.u_email == u_email)
     _star = basic.update_str_list(user.u_star, _new)
     User.update(User.u_email == u_email, {User.u_star: _star})
示例#5
0
 def add_course(cls, u_email, c_id):
     course = Course.query_one(Course.c_id == c_id)
     _new = dict(c_id=course.c_id, c_name=course.c_name, c_pic=course.c_pic)
     user = User.query_one(User.u_email == u_email)
     _own = basic.update_str_list(user.u_own, _new)
     User.update(User.u_email == u_email, {User.u_own: _own})