예제 #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')