summaryrefslogtreecommitdiff
path: root/docs/ref/request-response.txt
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2018-12-30 00:44:45 +0000
committerTim Graham <timograham@gmail.com>2018-12-29 19:44:45 -0500
commitb71e3d635a5731ec02469822694d06d964007f9b (patch)
treed7662d86c0f1546a5db720c54583db4214c1aa5e /docs/ref/request-response.txt
parente817ae74da0e515db31907ebcb2d00bcf7c3f5bc (diff)
Added examples to HttpRequest.build_absolute_uri() docs.
Diffstat (limited to 'docs/ref/request-response.txt')
-rw-r--r--docs/ref/request-response.txt11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
index 6ad879079f..9e445ee4ff 100644
--- a/docs/ref/request-response.txt
+++ b/docs/ref/request-response.txt
@@ -293,16 +293,21 @@ Methods
Example: ``"/minfo/music/bands/the_beatles/?print=true"``
-.. method:: HttpRequest.build_absolute_uri(location)
+.. method:: HttpRequest.build_absolute_uri(location=None)
Returns the absolute URI form of ``location``. If no location is provided,
the location will be set to ``request.get_full_path()``.
If the location is already an absolute URI, it will not be altered.
Otherwise the absolute URI is built using the server variables available in
- this request.
+ this request. For example:
- Example: ``"https://example.com/music/bands/the_beatles/?print=true"``
+ >>> request.build_absolute_uri()
+ 'https://example.com/music/bands/the_beatles/?print=true'
+ >>> request.build_absolute_uri('/bands/')
+ 'https://example.com/bands/'
+ >>> request.build_absolute_uri('https://example2.com/bands/')
+ 'https://example2.com/bands/'
.. note::