diff options
| author | Tom Christie | 2012-10-09 16:44:49 +0100 | 
|---|---|---|
| committer | Tom Christie | 2012-10-09 16:44:49 +0100 | 
| commit | 52a2ff8f77dc22a65e6f5780de8183f261472342 (patch) | |
| tree | 2218df44a8ad007dde447cbad9dd22fc970cbfee /docs/api-guide/reverse.md | |
| parent | 97a7f27c8219181e40dddcaf820545e08283de93 (diff) | |
| download | django-rest-framework-52a2ff8f77dc22a65e6f5780de8183f261472342.tar.bz2 | |
Docs tweaks
Diffstat (limited to 'docs/api-guide/reverse.md')
| -rw-r--r-- | docs/api-guide/reverse.md | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/docs/api-guide/reverse.md b/docs/api-guide/reverse.md index 8485087e..82cadffc 100644 --- a/docs/api-guide/reverse.md +++ b/docs/api-guide/reverse.md @@ -21,10 +21,12 @@ There's no requirement for you to use them, but if you do then the self-describi  ## reverse -**Signature:** `reverse(viewname, request, *args, **kwargs)` +**Signature:** `reverse(viewname, *args, **kwargs)`  Has the same behavior as [`django.core.urlresolvers.reverse`][reverse], except that it returns a fully qualified URL, using the request to determine the host and port. +You should **include the request as a keyword argument** to the function, for example: +      import datetime      from rest_framework.utils import reverse      from rest_framework.views import APIView @@ -34,16 +36,20 @@ Has the same behavior as [`django.core.urlresolvers.reverse`][reverse], except t  	        year = datetime.datetime.now().year  			data = {   				... -    		    'year-summary-url': reverse('year-summary', request, args=[year]) +    		    'year-summary-url': reverse('year-summary', args=[year], request=request)              }      		return Response(data)  ## reverse_lazy -**Signature:** `reverse_lazy(viewname, request, *args, **kwargs)` +**Signature:** `reverse_lazy(viewname, *args, **kwargs)`  Has the same behavior as [`django.core.urlresolvers.reverse_lazy`][reverse-lazy], except that it returns a fully qualified URL, using the request to determine the host and port. +As with the `reverse` function, you should **include the request as a keyword argument** to the function, for example: + +    api_root = reverse_lazy('api-root', request=request) +  [cite]: http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5  [reverse]: https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse  [reverse-lazy]: https://docs.djangoproject.com/en/dev/topics/http/urls/#reverse-lazy | 
