开发者

Example when request.POST contain query string in django

Please post example code when reques开发者_JAVA技巧t.POST contain query string in django, because i think my django version is bugged.

EDIT:

You simple can't, query string is always in GET, and this was my problem.


If your request is post:

request.method == 'POST'

but the requested url contains a query string. e.g:

/your-url?param1=value-one

you can still take POST parameters through:

request.POST.get("my-field", None)

and query string parameters through:

request.GET.get("param1")

althrough, you pick up all parameters at once (POST and GET), through REQUEST:

request.REQUEST['param1'] # comes from query string

request.REQUEST['my-field'] # comes from request BODY (POST)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜