On Sat, Apr 19, 2014 at 6:36 PM, nobody <[email protected]> wrote:
> Hi, > > I set up an URL when cliking a submit button, I got > http://myhost.com/user/?userid=5987. > > If it is a REQEST, I can get useid = request.GET['userid']. But in POST, I > could not get the variable from the POST, I could not even find the > variable in POST, the following check userid in request.POST was false, and > I cannot check if the syntax of next statement "userid = > request.POST.get("userid", "")" is correct or not. > > if userid in request.POST > userid = request.POST.get("userid", "") > > > > Also, at the moment, I made a hard coded absolutely URL in the submit > action: > > <form method="post" action="http://myhost.com/user/?userid={{request.user_id > }}">{% csrf_token %} > > Is there a key word for current URL I can put it in the action, for > example, like action = "{{ current_url }}/?userid={{ request.user_id }}"? > Hi, request.GET contains the URL keywords, regardless of whether it's a GET or POST request. In the case of a GET request, *all* the form data is contained in request.GET if it's a GET request; if it's a POST request, request.POST contains the form data, and request.GET contains the URL arguments. I hope that helps! Yours, Russ Magee %-) -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CAJxq849KtS0_SZ-4sjZEMxNyOTvRYDCF2WCYAHABOoOZfsCeEw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

