#21723 closed Cleanup/optimization (worksforme)
relative vs absolute in url tag documentation
Reported by: | Chris Jerdonek | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The language describing the url template tag is somewhat confusing because it uses the word "absolute" to describe a relative URL:
url: Returns an absolute path reference (a URL without the domain name) matching a given view...
I would replace this with language something like:
url: Returns the relative URL (URL without domain name) for the given view...
The key suggestion here is to use "relative" instead of "absolute."
Change History (2)
comment:1 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 11 years ago
I read the latest RFC (RFC 3986) on this topic. According to that document, the return value is an "absolute-path URI reference," which is a kind of relative URI reference. In contrast, an absolute URI includes the scheme.
Django also has HttpRequest.build_absolute_uri(), which returns an absolute URI.
I still think the wording can be improved. "Absolute path reference" seems obscure to me, and "URL" is mentioned only parenthetically in the first sentence about "url." When I first read that sentence, I thought it was trying to say "absolute URL reference," which lead to the confusion. An early version of the docs even says exactly that, "Returns an absolute URL (i.e., a URL without the domain name)" (from v1.1 docs).
Django uses the language "absolute url" to refer to the URL without the domain name in a few places. In particular the
get_absolute_url()
function.To me, relative url implies a url like
../../foo/bar
, not a url like/foo/bar
. Strictly speaking, the url/foo/bar
is neither relative or absolute, but it's closer to absolute.