Finally, I've changed my way to send parameters, it's much better send them 
by url.

El miércoles, 11 de marzo de 2015, 11:21:34 (UTC+1), elcaiaimar escribió:
>
> Hello!
>
> 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 values
>
> How 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+unsubscr...@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/dad86c29-22f3-42cc-9152-cbc78299c485%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to