Reputation: 2064
Is there a method, or an attribute in request object that I can access to return me the URL exactly as the client requested? With the query params included?
I've checked request.build_absolute_uri
after looking at this question but it just returns the URL without the query params.
I need the URL because my API response returns the URL for the "next page" of results. I could build it from the query_params
attributes, but this view takes a lot of query params and some exclude others, so having access to the request url would save me a lot of pain.
Upvotes: 9
Views: 11537
Reputation: 11360
To get full path, including query string, you want request.get_full_path()
Upvotes: 15