Dragonboard 410c搭载web服务器之用户交互系统
时间:02-09
来源:互联网
点击:
="line" id="LC264">
print('user_push=',user_push)
="line" id="LC265">
message.infoType=infoType#推送消息的类型
="line" id="LC266">
message.pushID=user_push.id#推送者ID
="line" id="LC267">
message.ownerID= key_user#接收者的ID
="line" id="LC268">
message.pushTim=timezone.localtime(timezone.now()).strftime("%Y-%m-%d %H:%M:%S")
="line" id="LC269">
message.isTop = 0 #置顶标志默认1
="line" id="LC270">
message.viewWeight = 1#阅读等级默认1
="line" id="LC271">
message.save()
="line">
="line" id="LC272">
print('message.id=',message.id)
="line" id="LC273">
messid=message.id
="line" id="LC274">
print('messid=',messid)
="line" id="LC275">
="line" id="LC276">
#由于post 的bug这里用html5前端来保存我们的messid
="line" id="LC277">
if key_input == 0:
="line" id="LC278">
print('please input text')
="line" id="LC279">
response = HttpResponseRedirect('/online/text/')
="line" id="LC280">
#将username写入浏览器cookie,失效时间为3600
="line" id="LC281">
response.set_cookie('username',username,3600)
="line" id="LC282">
response.set_cookie('messid',messid,3600)
="line" id="LC283">
="line" id="LC284">
print('index:messid=',messid)
="line" id="LC285">
return response
="line" id="LC286">
elif key_input == 1:
="line" id="LC287">
print('please input video')
="line" id="LC288">
response = HttpResponseRedirect('/online/video/')
="line" id="LC289">
#将username写入浏览器cookie,失效时间为3600
="line" id="LC290">
response.set_cookie('username',username,3600)
="line" id="LC291">
response.set_cookie('messid',messid,3600)
="line" id="LC292">
="line" id="LC293">
return response
="line" id="LC294">
else:
="line" id="LC295">
response = render_to_response('login_user.html' ,{'user_list':user_list,'username':username,'user_first':user_first,'messid':messid},context_instance=RequestContext(req))
="line" id="LC296">
print('error ~! just donot in this page')
="line" id="LC297">
response.set_cookie('messid',messid,3600)
="line" id="LC298">
="line" id="LC299">
return response
="line" id="LC300">
#return render_to_response('loginsuccee.html' ,{'user_list':json.dumps(user_list),'username':username,'user_first':user_first,'messid':messid},context_instance=RequestContext(req))
="line" id="LC301">
else:
="line" id="LC302">
return render_to_response('login_user.html' ,{'user_list': user_list,'user_first':user_first,'username':username},context_instance=RequestContext(req))
="line" id="LC303">
="line" id="LC304">
#退出
="line">
="line" id="LC305">
def logout(req):
="line" id="LC306">
response = HttpResponse('logout !!')
="line" id="LC307">
#清理cookie里保存username
="line" id="LC308">
response.delete_cookie('username')
="line" id="LC309">
response.delete_cookie('messid')
="line" id="LC310">
return response
="line" id="LC311">
#response = HttpResponse('logout !!')
="line" id="LC312">
#清理cookie里保存username
="line" id="LC313">
# response.delete_cookie('username')
="line" id="LC314">
# return response
="line" id="LC315">
="line" id="LC316">
="line" id
DragonBoard 410c Django Web服务 相关文章: