def deletetarea(request): if request.method == 'POST': tarea_form=TareaForm(request.POST) if tarea_form.is_valid(): tarea_form.save() html="Formulario enviado" return HttpResponse(html) #return render_to_response('index.html', {'formulario': recurso_form}) else: return HttpResponse("Formulario no correcto") else: #Formulario Vacio #form_recurso = RecursoForm() form_tarea = TareaForm() return render(request, 'form.html', {'form_tarea': form_tarea})
def newtarea(request): if request.method == 'POST': tarea_form=TareaForm(request.POST) print request.POST #print tarea_form.is_valid if tarea_form.is_valid(): print "HOLA" tarea_form.save() html="Formulario enviado" return HttpResponse(html) #return render_to_response('index.html', {'formulario': recurso_form}) else: print request.POST return HttpResponse("Formulario no correcto") else: #Formulario Vacio #form_recurso = RecursoForm() form_tarea = TareaForm() Capacidades = Capacidad.objects.all() Proyectos = Proyecto.objects.all() Recursos = Recurso.objects.all() return render(request, 'formtarea.html', {'form_tarea': form_tarea, 'capacidades': Capacidades, 'proyectos': Proyectos, 'recursos': Recursos })