The problem is that I need to redirect the request to an url and post to
this url the parameters I got from the initial request and display the post
url. Here is my views.py:
def prueba(request, seccion):
if request.POST:
new_data = request.POST.copy()
Ds_Merchant_Titular = new_data['Ds_Merchant_Titular']
Ds_Merchant_MerchantCode = new_data['Ds_Merchant_MerchantCode']
Ds_Merchant_Amount = new_data['Ds_Merchant_Amount']
Ds_Merchant_Currency = new_data['Ds_Merchant_Currency']
Ds_Merchant_Order = new_data['Ds_Merchant_Order']
correo_from = Ds_Merchant_Titular
correo_asunto = "[contacto] " + Ds_Merchant_MerchantCode
correo_to = []
correo_to.append(MIEMAIL)
correo_content = Ds_Merchant_Order
sendMail(correo_to, correo_asunto, correo_content, True,
correo_from)
params = urllib.urlencode({"Ds_Merchant_Titular":
Ds_Merchant_Titular, "Ds_Merchant_MerchantCode": Ds_Merchant_MerchantCode})
#f= urllib2.urlopen("https://sis.sermepa.es/sis/realizarPago
",params)
return f -> it doesnt workd
# return
HttpResponseRedirect("https://sis.sermepa.es/sis/realizarPago",params)
--> it doesn't work
On Mon, Feb 16, 2009 at 5:18 PM, Antoni Aloy <[email protected]> wrote:
>
> 2009/2/16 Mike <[email protected]>:
> >
> > Hi all,
> >
> > I m not familiar with django and I have found several problems trying
> > to sent a httpresponse with post parameters. I would like to return an
> > httpresponse (or httpredirect) to a new url with the request
> > parameters via post.
> >
> > Could anybody help me?
> > Thank you in advance,
> > Miguel
> >
> > I have defined a new view:
> >
> > def prueba(request, seccion):
> > if request.POST:
> > new_data = request.POST.copy()
> >
> > [get all the parameters]
> > [send a mail if correct]
> >
> >
> > response = HttpResponse ("newUrl")
> > #¿POST?
> > return HttpResponseRedirect(response)
> >
>
> After a post you should use a HttpResponseRedirect(url). If you need
> to have access to the post parameters an option is to save them in a
> session, or encode them in the url itslef.
>
> Hope it helps!
>
> --
> Antoni Aloy López
> Blog: http://trespams.com
> Site: http://apsl.net
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---