Redirect to external url with parameters in django

1 910 vues
Accéder directement au premier message non lu

Hossein Rashnoo

non lue,
27 janv. 2015, 02:30:0527/01/2015
à django...@googlegroups.com
I want when a user do something in my view then i redirect him to another website with some parameters as POST method Like when you submit a form.
I think its may be something like this:

    return HttpResponseRedirect("url","parameters")

How can i do that?

Stephen J. Butler

non lue,
27 janv. 2015, 02:39:4827/01/2015
à django...@googlegroups.com
Use django.utils urlencode.

return HttpResponseRedirect(base_url + '?' + urlencode(params))

Note that a redirect is always turned into a GET request, never a
POST. If you really need POST you'll have to construct a page with the
proper form elements, and then either have the user submit it (no-js)
or post it using JavaScript yourself.
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@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/6650db6b-1bd9-4f70-bbee-ed6bca3b95c2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message