예제 #1
0
def editgamecontact(request,id="-1"):
	context = {'topnav':'editgamecontact'}
	try:
		game = Game.objects.get(id=id)
	except Game.DoesNotExist:
		return render_to_response('unicorn/gamesdoesnotexist.html',)
	if request.user.is_authenticated():
		if not ((game.users.filter(id = request.user.id)[:1]) or (request.user.is_staff)):
			return HttpResponseRedirect(reverse('account_login'))

	if request.method == 'POST': 
		form = ContactForm(request.POST,instance = game) 
		if form.is_valid():
			form.save()
			context['success'] = True 
		else:
			context['error'] = True 
	else:
		form = ContactForm(instance=game)
	context['form'] = form;
	context['game'] = game;
	return render_to_response('unicorn/editgame_contact.html', context,context_instance=RequestContext(request))
예제 #2
0
def editgamecontact(request,id="-1"):
	context = {'topnav':'editgamecontact'}
	try:
		game = Game.objects.get(id=id)
	except Game.DoesNotExist:
		return render_to_response('unicorn/gamesdoesnotexist.html',)


	if request.method == 'POST': 
		form = ContactForm(request.POST,instance = game) 
		if form.is_valid():
			form.save()
			context['success'] = True 
		else:
			context['error'] = True 
	else:
		form = ContactForm(instance=game)
	context['form'] = form;
	context['game'] = game;
	return render_to_response('unicorn/editgame_contact.html', context,context_instance=RequestContext(request))
예제 #3
0
def submitgamecontact(request,id="-1"):
	context = {'topnav':'submitgamecontact'}
	try:
		game = Game.objects.get(id=id)
	except Game.DoesNotExist:
		return render_to_response('unicorn/gamesdoesnotexist.html',)


	if request.method == 'POST': 
		form = ContactForm(request.POST,instance = game) 
		if form.is_valid():
			form.save()
			context['success'] = True 
			return HttpResponseRedirect(reverse('games.views.submitgamepublish', kwargs={'id': game.id}))
		else:
			context['error'] = True 
	else:
		form = ContactForm(instance=game)
	context['form'] = form;
	context['game'] = game;
	return render_to_response('unicorn/submitgame_contact.html', context,context_instance=RequestContext(request))