コード例 #1
0
ファイル: views.py プロジェクト: refik/uppsala
def create(request):
	form = newMeet(request.POST)
	if form.is_valid():
		sender_new = request.user
		date_new = form.cleaned_data['date']
		place_new = form.cleaned_data['place']    
		meet = Meet(date=date_new, place=place_new, sender=sender_new)
		meet.save()
		meet.choice_set.create(choice='gelirim', vote=0)
		meet.choice_set.create(choice='gunde anlastik', vote=0)
		meet.choice_set.create(choice='emin degilim', vote=0)
		meet.choice_set.create(choice='gelemem', vote=0) 
		meet.save()
		return locals()
コード例 #2
0
ファイル: views.py プロジェクト: wawrek/uppsala
def create(request):
	form = newMeet(request.POST)
	if form.is_valid() and request.user.is_authenticated():
		sender_new = request.user
		date_new = form.cleaned_data['date']
		place_new = form.cleaned_data['place']    
		n = Meet(date=date_new, place=place_new, sender=sender_new)
		n.save()
		n.choice_set.create(choice='gelirim', vote=0)
		n.choice_set.create(choice='gunde anlastik', vote=0)
		n.choice_set.create(choice='emin degilim', vote=0)
		n.choice_set.create(choice='gelemem', vote=0) 
		n.save()
		return HttpResponseRedirect(reverse('uppsala.meet.views.result', args=(n.id,)))
	else:
		return render_to_response('meet/new.html')