Hello!
I'm having problems in a form. I want to send some values with it to
I've tried to put
How can I solve my problem?
-- I'm having problems in a form. I want to send some values with it to
'obras/edicionobra.html' but I also want to redirect to the page "/edicionobra/". In the code below I send the values and I go to edicionobra.html, however, the URL is /nuevacuenca/ and that's wrong.I've tried to put
HttpResponseRedirect("/edicionobra/") at the end of the form, but then I don't send the valuesHow can I solve my problem?
def NuevaCuenca(request):
if not request.user.is_authenticated():
return HttpResponseRedirect('/')
idobra=request.POST['obra']
lobras = Obra.objects.filter(id=idobra)
obra=lobras[0]
cuencas = CuencasObra(request)
if "nuevacuenca" in request.POST:
formulario = CuencasForm(request.POST)
if formulario.is_valid():
titulo = 'Formulario de cuenca'
dc=request.POST['descripcion_cuenca']
idobra=request.POST['obra']
cuenca=Cuenca(gid_obra_id=idobra, descripcion_cuenca=dc)
cuenca.save()
return render_to_response('obras/edicionobra.html', {'idobra':idobra, 'obra':obra, 'cuencas':cuencas}, context_instance=RequestContext(request))
else:
formulario = CuencasForm()
return render_to_response('cuencas/nuevacuenca.html',{'formulario':formulario, 'idobra':idobra, 'obra':obra}, context_instance=RequestContext(request))
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f5a1420-043b-4686-bd1f-3eb2eee383b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment