本文整理汇总了Python中models.Conference.save方法的典型用法代码示例。如果您正苦于以下问题:Python Conference.save方法的具体用法?Python Conference.save怎么用?Python Conference.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Conference
的用法示例。
在下文中一共展示了Conference.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: match_or_send_to_waiting_room
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import save [as 别名]
def match_or_send_to_waiting_room(call, schedule):
# Refreshing database object
flush_transaction()
call.reload()
if call.matched:
other = call.conference.call_set.exclude(pk=call.pk)[0]
data = send_to_conference_room(call, schedule, other, initial=False)
if data: return data
matchcall = find_match(schedule, call)
if matchcall:
conf = Conference()
conf.maxcapacity = 2
conf.datecreated = as_date(schedule)
conf.save()
call.conference = conf
call.matched = True
call.save()
matchcall.conference = conf
matchcall.matched = True
matchcall.save()
data = send_to_conference_room(call, schedule, matchcall, initial=True)
if data: return data
if call.user.profile.any_match:
call.user.profile.any_match = False
call.user.profile.save()
return render_to_response("twilioresponse.xml", { 'say' :"We are very sorry - We could not find you a match today, but tomorrow we'll do our best to compensate it! We wish you an awesome day!",
'hangup' : True })
#Check if we have exceeded the waiting redirect limits
elif call.retries >= REDIRECT_LIMIT:
# The user has reached the limit of redials, so hang up
logger.debug("LIMIT RETRIES - Ask to try to match with any person")
any_match = "We could not find any matches. If you'd like us to try to match you with Anyone please press any number now."
goodbye = "We wish you an Amazing day! Good bye!"
return render_to_response("twilioresponse.xml", { 'any_match' :any_match, 'schedule': schedule, 'hangup': True, 'goodbye' : goodbye })
call.retries = call.retries + 1
call.save()
# Send user to private conference (Conferencename=Username) or send them to the waiting room they were at
return send_to_waiting_room( HOLD_LIMIT
, schedule
, call.user.username
, False
, "Please bare with us - we'll find the best match for you!")
示例2: get_active_waiting_room
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import save [as 别名]
def get_active_waiting_room(schedule):
dateSchedule = as_date(schedule)
# Refreshing database
flush_transaction()
try:
allWaitingRooms = Conference.objects.filter(datecreated=dateSchedule, maxcapacity=WAITING_ROOM_MAX)
logger.debug("All waiting rooms: " + str(allWaitingRooms))
# Find free waiting room
for waiting in allWaitingRooms:
if waiting.available():
logger.debug("Waiting room chosen: " + str(waiting.pk))
return waiting
# No free waiting rooms so create one
except Conference.DoesNotExist:
pass # None found, so create one
waiting = Conference()
waiting.datecreated = dateSchedule
waiting.maxcapacity = WAITING_ROOM_MAX
waiting.save()
return waiting
示例3: post
# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import save [as 别名]
def post(self, id = None):
request = self.wsgi_request
response = self.wsgi_response
c = self.context
param_dict = dict(
url_title = request.params.url_title,
title = request.params.title,
desc = request.params.desc,
venue = request.params.venue,
start_date = parse(request.params.start_date),
end_date = parse(request.params.end_date),
twitter_handle = request.params.twitter_handle,
twitter_hashcode = request.params.twitter_hashcode)
content = param_dict
conf = Conference(**param_dict)
conf = conf.save()
conf.update_url_key()
self.set_body(conf.to_json())
response.headers['content-type'] = 'application/json'
return self.render()