예제 #1
0
def nueva_idea(request):
	usuario = request.user
	if request.method=='POST':
		formulario_ideas = IdeaForm(request.POST, request.FILES)
		if formulario_ideas.is_valid():
			formulario_ideas.save()
			return HttpResponseRedirect('/ideas')
	else:
		formulario_ideas = IdeaForm()
	return render_to_response('ideaform.html',{'formulario_ideas':formulario_ideas, 'usuario':usuario}, context_instance=RequestContext(request))
예제 #2
0
def editar_idea(request, id_idea):
	usuario = request.user
	idea = get_object_or_404(Idea, pk=id_idea)
	if request.method=='POST':
		formulario_ideas = IdeaForm(request.POST, instance=idea)
		if formulario_ideas.is_valid():
			formulario_ideas.save()
			return HttpResponseRedirect('/ideas')
	else:
		formulario_ideas = IdeaForm()
	return render_to_response('editaridea.html',{'idea':idea,'formulario_ideas':formulario_ideas, 'usuario':usuario}, context_instance=RequestContext(request))