本文整理汇总了Python中api_db_utils.APIDB.get_club_courses_im_trainer_of方法的典型用法代码示例。如果您正苦于以下问题:Python APIDB.get_club_courses_im_trainer_of方法的具体用法?Python APIDB.get_club_courses_im_trainer_of怎么用?Python APIDB.get_club_courses_im_trainer_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_db_utils.APIDB
的用法示例。
在下文中一共展示了APIDB.get_club_courses_im_trainer_of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: coach_club_membership
# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import get_club_courses_im_trainer_of [as 别名]
def coach_club_membership(req, uskey_membership):
"""
``GET`` @ |ca| + ``/memberships/<uskey_membership>``
Detail of a membership. |uroleOT|
"""
membership = req.model
member = membership.get_member
club = membership.get_club
ret = sanitize_json(membership.to_dict(), ['id', 'membership_type', 'status'])
ret['user'] = sanitize_json(member.to_dict(), ['id', 'nickname', 'avatar'])
# ret['course_count'] = APIDB.get_club_courses(club, count_only=True)
if membership.membership_type == "TRAINER":
courses = APIDB.get_club_courses_im_trainer_of(member, club)
else:
courses = APIDB.get_club_courses(club)
ret['subscriptions'] = sanitize_list(courses, ['id', 'name', 'description'])
return ret