本文整理汇总了Python中models.Activity.istimeout方法的典型用法代码示例。如果您正苦于以下问题:Python Activity.istimeout方法的具体用法?Python Activity.istimeout怎么用?Python Activity.istimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Activity
的用法示例。
在下文中一共展示了Activity.istimeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: public_act
# 需要导入模块: from models import Activity [as 别名]
# 或者: from models.Activity import istimeout [as 别名]
def public_act(request):
ret_data={}
errors =[]
if request.method=='POST':
if 'user' in request.session:
theme_act = request.POST.get('theme_act','')
if not theme_act:
errors.append('theme not exist')
class_act = request.POST.get('class_act','')
date_act = request.POST.get('date_act','')
time_act = request.POST.get('time_act','')
num_act = request.POST.get('num_act','')
address_act = request.POST.get('address_act','')
detail_act = request.POST.get('detail_act','')
username = request.session['user']
date_time = date_act + " " + time_act
userid = User.objects.get(name=username).id
now = datetime.datetime.fromtimestamp(time.mktime(time.
strptime(date_time, r"%Y/%m/%d %H:%M:%S")))
datess = str(now)
print datess
try:
a = int(num_act)
except Exception:
ret_data["ret"] = 'no int'
return HttpResponse(json.dumps(ret_data), content_type='application/json')
print "now is " +str(datess)
if len(errors) > 0:
ret_data['ret'] = 'no theme'
elif not num_act:
ret_data['ret'] = 'no people_count'
else:
pub_data = Activity(category = class_act, theme = theme_act,
begin_datatime = datess, people_count = num_act,
details = detail_act, submit_peopleId = userid,
location=address_act,joined_peopleId=userid)
#total=len(Activity.objects.all())+1
pub_data.istimeout = 'n'
pub_data.save()
total = pub_data.id
u=User.objects.get(id=userid)
if u.uncompleted_id=='':
u.uncompleted_id=str(total)
else:
u.uncompleted_id+=(','+str(total))
u.save()
ret_data['ret'] = 'ok'
else:
ret_data['ret'] = 'failed'
else:
ret_data['ret'] = 'failed'
return HttpResponse(json.dumps(ret_data), content_type='application/json')