本文整理汇总了Python中models.Conference.get方法的典型用法代码示例。如果您正苦于以下问题:Python Conference.get方法的具体用法?Python Conference.get怎么用?Python Conference.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Conference
的用法示例。
在下文中一共展示了Conference.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import get [as 别名]
def post(self, id = None):
request = self.wsgi_request
response = self.wsgi_response
c = self.context
param_dict = dict(
title = request.params.title,
conf_id = request.params.conf_id,
desc = request.params.desc,
venue = request.params.venue,
talk_type = request.params.talk_type,
start_date = parse(request.params.start_date),
end_date = parse(request.params.end_date),
duration = request.params.duration,
speaker_title = request.params.speaker_title)
content = param_dict
session = Session(**param_dict)
session = session.save()
conf = Conference.get(session.conf_id)
if conf:
conf.add_session(session)
self.set_body(session.to_json())
response.headers['content-type'] = 'application/json'
return self.render()
示例2: get
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import get [as 别名]
def get(self, conf_handle = None):
request = self.wsgi_request
response = self.wsgi_response
c = self.context
if conf_handle:
conf_id = Conference.get_id_from_url_title(conf_handle)
c.conf = Conference.get(conf_id)
if c.conf:
return self.render_stuff('/index.html')
self.set_body("Please enter a valid conference handle..")
return self.render()
示例3: delete
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import get [as 别名]
def delete(self, id = None):
request = self.wsgi_request
response = self.wsgi_response
c = self.context
if id is None:
self.set_body('Conf id is a Must')
else:
conf = Conference.get(id)
if conf is None:
self.set_body('No conference with %d exist' % (id))
else:
conf.delete()
self.set_body("Deleted Successfully...")
return self.render()
示例4: put
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import get [as 别名]
def put(self, id = None):
request = self.wsgi_request
response = self.wsgi_response
c = self.context
if id is None:
self.set_body('Conf id is a Must')
else:
conf = Conference.get(id)
if request.params.title: conf.title = request.params.title
if request.params.url_title: conf.url_title = request.params.url_title
if request.params.desc: conf.desc = request.params.desc
if request.params.venue: conf.venue = request.params.venue
if request.params.start_date: conf.start_date = parse(request.params.start_date)
if request.params.end_date: conf.end_date = parse(request.params.end_date)
if request.params.twitter_handle: conf.twitter_handle = request.params.twitter_handle
if request.params.twitter_hashcode: conf.twitter_hashcode = request.params.twitter_hashcode
conf = conf.save()
conf.update_url_key()
self.set_body(conf.to_json())
return self.render()