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


Python APIDB.create_club方法代码示例

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


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

示例1: coach_club_create

# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import create_club [as 别名]
def coach_club_create(req):
    """
    ``POST`` @ |ca| + ``/clubs``

    Create a club.
    """
    j_req = json_from_request(req, mandatory_props=["name", "url", "isOpen"], optional_props=['tags', "description"])
    club = APIDB.create_club(**j_req)
    APIDB.add_owner_to_club(req.user, club)
    # users the rendering of club details, add 201 code
    req.model = club
    return HttpCreated(coach_club_details(req, None))
开发者ID:gymcentral,项目名称:gymcentral,代码行数:14,代码来源:api_coach.py

示例2: Key

# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import create_club [as 别名]
__author__ = 'Stefano Tranquillini <[email protected]>'
from datetime import datetime, timedelta

from api_db_utils import APIDB
from models import User
from gaebasepy.gc_utils import date_to_js_timestamp


user = User.query(User.email == '[email protected]').get()
club = APIDB.create_club(name="gymCentral Free Club",
                         description="This club is provided by gymCentral, with a free demo course for everyone who wants to feel the experience of our service.",
                         is_open=True, url="http://gymcentral.net")
# club created
# club = Key('Club',6192449487634432).get()
APIDB.add_owner_to_club(user, club)
# APIDB.add_trainer_to_club(iman, club,status="ACCEPTED")
# Course
data = dict(name="Strength and balance", description="Free course to improve your strength and balance.",
            start_date=date_to_js_timestamp(datetime(2015, 1, 1)),
            end_date=date_to_js_timestamp(datetime(2015, 12, 31)),
            course_type="SCHEDULED", max_level=2)
course = APIDB.create_course(club, **data)
APIDB.add_trainer_to_course(user, course)
# Course created
# course = Key('Course',4785074604081152).get()
# Indicators
data = dict(name="How are you today?", indicator_type="INTEGER", description="How are you today", required=True,
            answer_type='CHECKBOXES',
            possible_answers=[dict(name='1', text='Very bad', value='1'), dict(name='2', text='Not so good', value='2'),
                              dict(name='3', text='Ok', value='3'), dict(name='4', text='Good', value='4'),
                              dict(name='5', text='Very good', value='5')])
开发者ID:gymcentral,项目名称:gymcentral,代码行数:33,代码来源:creation_script.py


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