Ejemplo n.º 1
0
Archivo: views.py Proyecto: jacsice/ynu
def symptom(request, symptom='0', name=None):
	"""
	某一个部位的症状
	"""
	#print "s",symptom
	if symptom == '0':
		#全部身体部位
		open_id = request.GET.get("open_id")
		if open_id is not None:
			user = User.objects.get(open_id=open_id, is_deleted=0)
			request.session['user_id'] = user.id
		body_list = Symptom.objects.filter(parent_body=None)
		return render_to_response('body.html',RequestContext(request,
								 {'body_list':body_list}))
	else:
		#某一部位的主症状
		symptom_list = Symptom.objects.filter(parent_body=symptom)
		s = Symptom.objects.get(id=symptom)

		user_id = request.session['user_id']
		user = User.objects.get(id=user_id, is_deleted=0)
		
		#身体和部位同为symtom
		history = History(user=user, meta_id=symptom, meta_key="symptom")
		history.save()
		return render_to_response('symptom.html',RequestContext(request,
								 {'symptom_list':symptom_list, "symptom":s.name}))
Ejemplo n.º 2
0
Archivo: utils.py Proyecto: jacsice/ynu
def history_save(request, meta_id, meta_key):
    """
    保存用户的点击纪录
    """
    user_id = request.session['user_id']
    history = History(user_id=user_id, meta_id=meta_id, meta_key=meta_key)
    print "success1"
    history.save()
    print "success2"