Exemplo n.º 1
0
def salon_add(request):
	try:
		edit_type = request.POST['edit_type']
	except(KeyError):
		return render_to_response('salon/add.html', {}, context_instance=RequestContext(request))
	else:
		salon = Salon()
		salon.code = request.POST['code']
		salon.name = request.POST['name']
		salon.start_time = request.POST['start_time']
		salon.end_time = request.POST['end_time']
		salon.creator = request.POST['creator']
		salon.description = request.POST['description']
		salon.address = request.POST['address']
		salon.save()
		return HttpResponseRedirect(reverse('home'))
Exemplo n.º 2
0
def salon_add(request):
	try:
		edit_type = request.POST['edit_type']
	except(KeyError):
		return render_to_response('salon/add.html', {}, context_instance=RequestContext(request))
	else:
		salon = Salon()
		salon.code = request.POST['code']
		salons_in_db = Salon.objects.filter(code = salon.code)
		if len(salons_in_db) != 0:
			return salon_list(request, u"沙龙代号" + salon.code + u"已存在,不允许重复");
		salon.name = request.POST['name']
		salon.start_time = request.POST['start_time']
		salon.end_time = request.POST['end_time']
		salon.creator = request.POST['creator']
		salon.description = request.POST['description']
		salon.address = request.POST['address']
		salon.save()
		return HttpResponseRedirect('/salon/')