def nueva_pareja(request): if request.method=='POST': formulario = ParejaForm(request.POST, request.FILES) if formulario.is_valid(): formulario.save() return HttpResponseRedirect('/parejas') else: formulario = ParejaForm() return render_to_response('parejaform.html',{'formulario':formulario}, context_instance=RequestContext(request))
def editar_pareja(request, idpareja): pareja = Pareja.objects.get(idpareja=idpareja) if request.method=='POST': form = ParejaForm(request.POST, instance = pareja) if form.is_valid(): form.save() return HttpResponseRedirect('/parejas') else: form = ParejaForm(instance = pareja) return render_to_response('editar_pareja.html', {'form':form}, context_instance=RequestContext(request))
def nueva_pareja(request): if request.method == 'POST': formulario = ParejaForm(request.POST, request.FILES) if formulario.is_valid(): formulario.save() return HttpResponseRedirect('/parejas') else: formulario = ParejaForm() return render_to_response('parejaform.html', {'formulario': formulario}, context_instance=RequestContext(request))
def editar_pareja(request, idpareja): pareja = Pareja.objects.get(idpareja=idpareja) if request.method == 'POST': form = ParejaForm(request.POST, instance=pareja) if form.is_valid(): form.save() return HttpResponseRedirect('/parejas') else: form = ParejaForm(instance=pareja) return render_to_response('editar_pareja.html', {'form': form}, context_instance=RequestContext(request))