当前位置: 首页>>代码示例>>Python>>正文


Python APIDB.create_session方法代码示例

本文整理汇总了Python中api_db_utils.APIDB.create_session方法的典型用法代码示例。如果您正苦于以下问题:Python APIDB.create_session方法的具体用法?Python APIDB.create_session怎么用?Python APIDB.create_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api_db_utils.APIDB的用法示例。


在下文中一共展示了APIDB.create_session方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: coach_course_session_create

# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import create_session [as 别名]
def coach_course_session_create(req, uskey_course):
    """
    ``POST`` @ |ca| +  ``/course/<uskey_course>/sessions``

    Create a sessions for the course. |uroleOT|
    """
    course = req.model
    j_req = json_from_request(req, mandatory_props=["name", "sessionType", ],
                              optional_props=["startDate", "endDate", "weekNo", "dayNo", "url", "metaData",
                                              "activities"])

    session = APIDB.create_session(course, **j_req)

    return HttpCreated(dict(id=session.id))
开发者ID:gymcentral,项目名称:gymcentral,代码行数:16,代码来源:api_coach.py

示例2: Key

# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import create_session [as 别名]
second_ex = APIDB.create_activity(club, **data)
# second_ex = Key('Exercise',4642138092470272).get()
startdate = datetime(2015, 1, 5)
week = 1
while (startdate < course.end_date):
    enddate = startdate + timedelta(days=7)
    data = dict(name="Session " + str(week), session_type="JOINT",
         start_date=date_to_js_timestamp(startdate),
         end_date=date_to_js_timestamp(enddate),
         activities=[first_ex.id, second_ex.id],
         on_before=[how_are_you.id],
         on_after=[how_was_session.id],)
    week += 1
    startdate += timedelta(days=7)
    print "%s %s" % (week, startdate)
    APIDB.create_session(course, **data)
# session1
# data = dict(name="pre ",session_type="JOINT",
# start_date=date_to_js_timestamp(datetime.now()),
# end_date=date_to_js_timestamp(datetime(2015,9,1,23,59)),
# activities=[first_ex.id,second_ex.id],
# on_before=[how_are_you.id],
# on_after=[how_was_session.id,level_up.id])
# first_session = APIDB.create_session(course,**data)
# # first_session = Key("Session",4916191365693440).get()

# data = dict(name="first day",session_type="JOINT",
# start_date=date_to_js_timestamp(datetime(2015,9,1,00,01)),
# end_date=date_to_js_timestamp(datetime(2015,9,2,23,59)),
# activities=[first_ex.id,second_ex.id],
# on_before=[how_are_you.id],
开发者ID:gymcentral,项目名称:gymcentral,代码行数:33,代码来源:creation_script.py


注:本文中的api_db_utils.APIDB.create_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。