本文整理汇总了Python中models.Session.speakers方法的典型用法代码示例。如果您正苦于以下问题:Python Session.speakers方法的具体用法?Python Session.speakers怎么用?Python Session.speakers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Session
的用法示例。
在下文中一共展示了Session.speakers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createSession
# 需要导入模块: from models import Session [as 别名]
# 或者: from models.Session import speakers [as 别名]
def createSession(self, request):
""" Creates Session from given SESSION_POST_REQUEST_FOR_CONFERENCE and returns a SessionForm."""
# (SessionForm, websafeConferenceKey) -- open only to the organizer of the conference
profile = self._getProfileFromUser()
conf = ndb.Key(urlsafe=request.websafeConferenceKey).get()
if not conf:
raise endpoints.NotFoundException(
'No conference found with key: %s' % request.websafeConferenceKey)
if conf.key.parent().get() != profile:
raise endpoints.UnauthorizedException('Session creation is open only to the organizer of the conference!')
# copy SESSION_POST_REQUEST_FOR_CONFERENCE/ProtoRPC Message into dict
data = {field.name: getattr(request, field.name) for field in request.all_fields()}
session = Session(name=data['name'],parent=conf.key)
# convert dates from strings to Date objects; set month based on start_date
if data['dateTime']:
session.date = data['dateTime'].date()
session.time = data['dateTime'].time()
if data['highlights']:
session.highlights = data['highlights']
if data['typeOfSession']:
session.typeOfSession = data['typeOfSession']
if data['duration']:
session.duration = data['duration']
if data['speakers']:
session.speakers = data['speakers']
session.put()
if data['speakers']:
session.speakers = data['speakers']
logging.debug("Creating session with speakers, adding task to taskqueue.", str(session))
taskqueue.add(url='/tasks/add_featured_speaker', params={'sessionKeyUrlSafe': session.key.urlsafe()})
return self._copySessionToForm(session)