Reputation: 1368
Hi i am making an webserver , In which I have to hit some request from html page and return the response. The URL which is generated using html is
but in the server side I am not able to see the request data. I am using
q = QueryDict(request.body)
but it is showing <QueryDict: {}>
How to find the all the parameters coming in request.
Upvotes: 5
Views: 7221
Reputation: 10609
In your case you send the data in url so access the data through request.GET
as follow:
username = request.GET.get('Username')
start_date = request.GET.get('startDate')
# ... the same for all the other parameter after the `?` marque.
In fact there is a difference between request data
, request.body
, request.GET
and request.POST
:
request.body
or request.POST
.request.data
. You may also find in Internet request.DATA
that correct but it's deprecated in the newer version of DRF in favor of request.data.request.GET
as explained above.Upvotes: 7