aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/reverse.md
diff options
context:
space:
mode:
authorJames Rutherford2015-03-11 10:38:03 +0000
committerJames Rutherford2015-03-11 10:38:03 +0000
commit4a2d27975ab5249269aebafd803be87a2107092b (patch)
tree55b524c93b02eef404304f734be98871bbb1324f /docs/api-guide/reverse.md
parent856dc855c952746f566a6a8de263afe951362dfb (diff)
parentdc56e5a0f41fdd6350e91a5749023d086bd1640f (diff)
downloaddjango-rest-framework-4a2d27975ab5249269aebafd803be87a2107092b.tar.bz2
Merge pull request #1 from tomchristie/master
Merge in from upstream
Diffstat (limited to 'docs/api-guide/reverse.md')
-rw-r--r--docs/api-guide/reverse.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/api-guide/reverse.md b/docs/api-guide/reverse.md
index 19930dc3..71fb83f9 100644
--- a/docs/api-guide/reverse.md
+++ b/docs/api-guide/reverse.md
@@ -1,4 +1,4 @@
-<a class="github" href="reverse.py"></a>
+source: reverse.py
# Returning URLs
@@ -17,7 +17,7 @@ The advantages of doing so are:
REST framework provides two utility functions to make it more simple to return absolute URIs from your Web API.
-There's no requirement for you to use them, but if you do then the self-describing API will be able to automatically hyperlink it's output for you, which makes browsing the API much easier.
+There's no requirement for you to use them, but if you do then the self-describing API will be able to automatically hyperlink its output for you, which makes browsing the API much easier.
## reverse
@@ -27,13 +27,13 @@ Has the same behavior as [`django.core.urlresolvers.reverse`][reverse], except t
You should **include the request as a keyword argument** to the function, for example:
- import datetime
from rest_framework.reverse import reverse
from rest_framework.views import APIView
-
+ from django.utils.timezone import now
+
class APIRootView(APIView):
def get(self, request):
- year = datetime.datetime.now().year
+ year = now().year
data = {
...
'year-summary-url': reverse('year-summary', args=[year], request=request)