Ejemplo n.º 1
0
def checkin(request, salon_code):
	barcode = request.GET['barcode']
	salon = Salon.objects.get(code = salon_code)
	msg=''	
	try:
		checking_user = User.objects.get(salon = salon,barcode=barcode)
	except:
		msg=u"二维码  "+unicode(barcode)+u"  对应的用户不存在!"
	else:
		User.checkined(checking_user.user_id)
		msg=unicode(checking_user.name)+u" 已在 "+unicode(salon.code)+u" 签到成功!"
	return render_to_response('salon/checkin_manual.html',{"salon_code":salon_code,"msg":msg})
Ejemplo n.º 2
0
def users_add(request, salon_id):
	try:
		edit_type = request.POST['edit_type']
	except(KeyError):
		return render_to_response('user/add.html', {'salon_id':salon_id}, context_instance=RequestContext(request))
	else:
		salon = Salon.objects.get(code = salon_id)
		user = User()
		user.salon = salon
		user.name = request.POST['name']
		user.company = request.POST['company']
		user.mobile = request.POST['mobile']
		user.email = request.POST['email']
		users = User.objects.filter(salon = salon.salon_id, email = user.email)
		if len(users) != 0:
			error_message = u"邮箱 %s 已经注册过了" % user.email
			return salon_get(request, user.salon.code, error_message);

		user.introduction = request.POST['introduction']
		user.barcode = gen_barcode_md5(salon, user)
		user.register_time = datetime.datetime.today()
		user.status = 13
		user.save()
		return HttpResponseRedirect('/salon/' + user.salon.code + '/')
Ejemplo n.º 3
0
def salon_get(request, salon_id, message = None):
	salon = Salon.objects.get(code = salon_id)
	untreated_users = User.get_untreated(salon.salon_id)
	accepted_users = User.get_accepted(salon.salon_id)
	rejected_users = User.get_rejected(salon.salon_id)
	return render_to_response('salon/view.html', {'message':message, 'salon':salon, 'salon_code':salon.code, 'untreated_users':untreated_users,'accepted_users':accepted_users,'rejected_users':rejected_users}, context_instance=RequestContext(request))
Ejemplo n.º 4
0
def user_reject(request, salon_id, user_id):
	User.reject(user_id);
	return HttpResponseRedirect('/salon/'+salon_id+'/');