From 65ccb1b7e4be278f5d14a97d50bc8a4e94b3001d Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 30 Dec 2018 00:44:45 +0000 Subject: [2.1.x] Added examples to HttpRequest.build_absolute_uri() docs. Backport of b71e3d635a5731ec02469822694d06d964007f9b from master. --- docs/ref/request-response.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'docs') 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. - - Example: ``"https://example.com/music/bands/the_beatles/?print=true"`` + this request. For example: + + >>> 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:: -- cgit v1.3