From 2d5f7f201ffcc8c371e9f36821c2ae0e13dcecca Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 21 Jun 2013 22:19:14 +0100 Subject: Update router docs on base_name. Refs #933. --- docs/api-guide/routers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index f16fa946..b74b6e13 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -26,7 +26,7 @@ There are two mandatory arguments to the `register()` method: Optionally, you may also specify an additional argument: -* `base_name` - The base to use for the URL names that are created. If unset the basename will be automatically generated based on the `model` or `queryset` attribute on the viewset, if it has one. +* `base_name` - The base to use for the URL names that are created. If unset the basename will be automatically generated based on the `model` or `queryset` attribute on the viewset, if it has one. Note that if the viewset does not include a `model` or `queryset` attribute then you must set `base_name` when registering the viewset. The example above would generate the following URL patterns: -- cgit v1.2.3 From a68f473dd8438c7d7b0f8ec4b4dc74aa0544143d Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 21 Jun 2013 23:25:14 +0200 Subject: Brackets not required on decorator without arguments --- docs/api-guide/viewsets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index 25d11bfb..ad961636 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -108,7 +108,7 @@ For example: queryset = User.objects.all() serializer_class = UserSerializer - @action() + @action def set_password(self, request, pk=None): user = self.get_object() serializer = PasswordSerializer(data=request.DATA) -- cgit v1.2.3 From 4f7f93e20ef53fbc0b66766158bca75ebddce2ed Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 21 Jun 2013 22:28:36 +0100 Subject: Added @freakydug, for changes in #941. Thanks :) --- docs/topics/credits.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/topics/credits.md b/docs/topics/credits.md index 3f0ee429..a7c09b5b 100644 --- a/docs/topics/credits.md +++ b/docs/topics/credits.md @@ -142,6 +142,7 @@ The following people have helped make REST framework great. * Areski Belaid - [areski] * Ethan Freman - [mindlace] * David Sanders - [davesque] +* Philip Douglas - [freakydug] Many thanks to everyone who's contributed to the project. @@ -320,4 +321,4 @@ You can also contact [@_tomchristie][twitter] directly on twitter. [areski]: https://github.com/areski [mindlace]: https://github.com/mindlace [davesque]: https://github.com/davesque - +[freakydug]: https://github.com/freakydug -- cgit v1.2.3 From 8cc63b09f6065e0197e060cc4d62b560196c8877 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 21 Jun 2013 22:42:04 +0100 Subject: Add support for StreamingHttpResponse. Closes #939 --- docs/api-guide/responses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/responses.md b/docs/api-guide/responses.md index f83b8194..399b7c23 100644 --- a/docs/api-guide/responses.md +++ b/docs/api-guide/responses.md @@ -10,7 +10,7 @@ REST framework supports HTTP content negotiation by providing a `Response` class The `Response` class subclasses Django's `SimpleTemplateResponse`. `Response` objects are initialised with data, which should consist of native Python primitives. REST framework then uses standard HTTP content negotiation to determine how it should render the final response content. -There's no requirement for you to use the `Response` class, you can also return regular `HttpResponse` objects from your views if you want, but it provides a nicer interface for returning Web API responses. +There's no requirement for you to use the `Response` class, you can also return regular `HttpResponse` or `StreamingHttpResponse` objects from your views if required. Using the `Response` class simply provides a nicer interface for returning content-negotiated Web API responses, that can be rendered to multiple formats. Unless you want to heavily customize REST framework for some reason, you should always use an `APIView` class or `@api_view` function for views that return `Response` objects. Doing so ensures that the view can perform content negotiation and select the appropriate renderer for the response, before it is returned from the view. -- cgit v1.2.3 From fb6bcd9f06daaca51441c6b851d6411621d32c26 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 21 Jun 2013 22:43:01 +0100 Subject: Update release notes, noting support for StreamingHttpResponse. Refs #939 --- docs/topics/release-notes.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs') diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index f49dd5c8..b08ac058 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -43,6 +43,7 @@ You can determine your currently installed version using `pip freeze`: ### Master * Added `trailing_slash` option to routers. +* Include support for `HttpStreamingResponse`. * Support wider range of default serializer validation when used with custom model fields. * Bugfix: Return error correctly when OAuth non-existent consumer occurs. * Bugfix: Allow `FileUploadParser` to correctly filename if provided as URL kwarg. -- cgit v1.2.3 From 8d83ff8e6c8513d0a88d6b1fecb34ed86f1e2085 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 21 Jun 2013 23:12:16 +0100 Subject: Add decorator brackets back. Refs #941 --- docs/api-guide/viewsets.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/viewsets.md b/docs/api-guide/viewsets.md index ad961636..25d11bfb 100644 --- a/docs/api-guide/viewsets.md +++ b/docs/api-guide/viewsets.md @@ -108,7 +108,7 @@ For example: queryset = User.objects.all() serializer_class = UserSerializer - @action + @action() def set_password(self, request, pk=None): user = self.get_object() serializer = PasswordSerializer(data=request.DATA) -- cgit v1.2.3 From 13a3c993ab20e7af510d615a5eafaa87667b8efb Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 26 Jun 2013 11:30:27 +0100 Subject: Fix incorrect example --- docs/api-guide/generic-views.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md index cd1bc7a1..67853ed0 100755 --- a/docs/api-guide/generic-views.md +++ b/docs/api-guide/generic-views.md @@ -92,7 +92,8 @@ May be overridden to provide dynamic behavior such as returning a queryset that For example: def get_queryset(self): - return self.user.accounts.all() + user = self.request.user + return user.accounts.all() #### `get_object(self)` -- cgit v1.2.3 From 494703fc8e916a9b7a318ec8bc7d774ef31de14e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 26 Jun 2013 22:40:14 +0100 Subject: Update release notes --- docs/topics/release-notes.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs') diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index b08ac058..ce4df83c 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -45,6 +45,7 @@ You can determine your currently installed version using `pip freeze`: * Added `trailing_slash` option to routers. * Include support for `HttpStreamingResponse`. * Support wider range of default serializer validation when used with custom model fields. +* OAuth2 provider usez timezone aware datetimes when supported. * Bugfix: Return error correctly when OAuth non-existent consumer occurs. * Bugfix: Allow `FileUploadParser` to correctly filename if provided as URL kwarg. * Bugfix: Fix `ScopedRateThrottle`. -- cgit v1.2.3 From cb83bc373f8044ec21f5affabda0540ed0876357 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 26 Jun 2013 22:44:44 +0100 Subject: Added @trwired for fix #943. Thanks :) --- docs/topics/credits.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs') diff --git a/docs/topics/credits.md b/docs/topics/credits.md index a7c09b5b..94760c74 100644 --- a/docs/topics/credits.md +++ b/docs/topics/credits.md @@ -143,6 +143,7 @@ The following people have helped make REST framework great. * Ethan Freman - [mindlace] * David Sanders - [davesque] * Philip Douglas - [freakydug] +* Igor Kalat - [trwired] Many thanks to everyone who's contributed to the project. @@ -322,3 +323,4 @@ You can also contact [@_tomchristie][twitter] directly on twitter. [mindlace]: https://github.com/mindlace [davesque]: https://github.com/davesque [freakydug]: https://github.com/freakydug +[trwired]: https://github.com/trwired -- cgit v1.2.3 From af2fdc03a6f4cafe6e2f19b2adcf59c8918088f2 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 26 Jun 2013 22:45:39 +0100 Subject: Update release notes --- docs/topics/release-notes.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs') diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index ce4df83c..4fecbf1f 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -45,6 +45,7 @@ You can determine your currently installed version using `pip freeze`: * Added `trailing_slash` option to routers. * Include support for `HttpStreamingResponse`. * Support wider range of default serializer validation when used with custom model fields. +* UTF-8 Support for browsable API descriptions. * OAuth2 provider usez timezone aware datetimes when supported. * Bugfix: Return error correctly when OAuth non-existent consumer occurs. * Bugfix: Allow `FileUploadParser` to correctly filename if provided as URL kwarg. -- cgit v1.2.3 From 4d22a65e78432a2aa70ddc80395a014a7c9e299e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 26 Jun 2013 23:26:35 +0100 Subject: Fix sidebar styling when browser window is too small --- docs/css/default.css | 4 ++++ docs/template.html | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'docs') diff --git a/docs/css/default.css b/docs/css/default.css index a4f05daa..af6a9cc0 100644 --- a/docs/css/default.css +++ b/docs/css/default.css @@ -303,3 +303,7 @@ table { border-color: white; margin-bottom: 0.6em; } + +.side-nav { + overflow-y: scroll; +} diff --git a/docs/template.html b/docs/template.html index 53656e7d..14ecc9c7 100644 --- a/docs/template.html +++ b/docs/template.html @@ -198,5 +198,14 @@ $('.dropdown-menu').on('click touchstart', function(event) { event.stopPropagation(); }); + + // Dynamically force sidenav to no higher than browser window + $('.side-nav').css('max-height', window.innerHeight - 125); + + $(function(){ + $(window).resize(function(){ + $('.side-nav').css('max-height', window.innerHeight - 125); + }); + }); -- cgit v1.2.3 From 124ae8c2c88d48b67fbaee77e337e8a6f37d1b70 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 27 Jun 2013 12:58:38 +0100 Subject: Tweak styling for max-height of sidenav --- docs/template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/template.html b/docs/template.html index 14ecc9c7..21771025 100644 --- a/docs/template.html +++ b/docs/template.html @@ -200,11 +200,11 @@ }); // Dynamically force sidenav to no higher than browser window - $('.side-nav').css('max-height', window.innerHeight - 125); + $('.side-nav').css('max-height', window.innerHeight - 130); $(function(){ $(window).resize(function(){ - $('.side-nav').css('max-height', window.innerHeight - 125); + $('.side-nav').css('max-height', window.innerHeight - 130); }); }); -- cgit v1.2.3 From 7ba2f44a0f0e5ed7bac0fbdbb0112bbfe43f6d24 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 27 Jun 2013 13:00:05 +0100 Subject: Version 2.3.6 --- docs/topics/release-notes.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md index 4fecbf1f..d379ab74 100644 --- a/docs/topics/release-notes.md +++ b/docs/topics/release-notes.md @@ -40,13 +40,15 @@ You can determine your currently installed version using `pip freeze`: ## 2.3.x series -### Master +### 2.3.6 + +**Date**: 27th June 2013 * Added `trailing_slash` option to routers. * Include support for `HttpStreamingResponse`. * Support wider range of default serializer validation when used with custom model fields. * UTF-8 Support for browsable API descriptions. -* OAuth2 provider usez timezone aware datetimes when supported. +* OAuth2 provider uses timezone aware datetimes when supported. * Bugfix: Return error correctly when OAuth non-existent consumer occurs. * Bugfix: Allow `FileUploadParser` to correctly filename if provided as URL kwarg. * Bugfix: Fix `ScopedRateThrottle`. -- cgit v1.2.3 From 1f6a59d76da286e7a89e8e41317beb16a4aab7c7 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 27 Jun 2013 13:41:42 +0100 Subject: Moar hyperlinks --- docs/index.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/index.md b/docs/index.md index b04e2346..de4b01c6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,11 +15,11 @@ Django REST framework is a powerful and flexible toolkit that makes it easy to b Some reasons you might want to use REST framework: -* The Web browseable API is a huge usability win for your developers. -* Authentication policies including OAuth1a and OAuth2 out of the box. -* Serialization that supports both ORM and non-ORM data sources. -* Customizable all the way down - just use regular function-based views if you don't need the more powerful features. -* Extensive documentation, and great community support. +* The [Web browseable API][sandbox] is a huge usability win for your developers. +* [Authentication policies][authentication] including [OAuth1a][oauth1-section] and [OAuth2][oauth2-section] out of the box. +* [Serialization][serializers] that supports both [ORM][modelserializer-section] and [non-ORM][serializer-section] data sources. +* Customizable all the way down - just use [regular function-based views][functionview-section] if you don't need the [more][generic-views] [powerful][viewsets] [features][routers]. +* [Extensive documentation][index], and [great community support][group]. There is a live example API for testing purposes, [available here][sandbox]. @@ -250,6 +250,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [django-oauth2-provider]: https://github.com/caffeinehit/django-oauth2-provider [0.4]: https://github.com/tomchristie/django-rest-framework/tree/0.4.X [image]: img/quickstart.png +[index]: . +[oauth1-section]: api-guide/authentication.html#oauthauthentication +[oauth2-section]: api-guide/authentication.html#oauth2authentication +[serializer-section]: api-guide/serializers.html#serializers +[modelserializer-section]: api-guide/serializers.html#modelserializer +[functionview-section]: api-guide/views.html#function-based-views [sandbox]: http://restframework.herokuapp.com/ [quickstart]: tutorial/quickstart.md -- cgit v1.2.3 From f5f23793e34324552f323725fa25f09b34380acc Mon Sep 17 00:00:00 2001 From: Rudolf Olah Date: Thu, 27 Jun 2013 16:30:24 -0400 Subject: #955 updated documentation for overriding `routes` attribute in Router sub-classes --- docs/api-guide/routers.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index b74b6e13..feff0fbf 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -98,7 +98,7 @@ As with `SimpleRouter` the trailing slashs on the URL routes can be removed by s Implementing a custom router isn't something you'd need to do very often, but it can be useful if you have specific requirements about how the your URLs for your API are strutured. Doing so allows you to encapsulate the URL structure in a reusable way that ensures you don't have to write your URL patterns explicitly for each new view. -The simplest way to implement a custom router is to subclass one of the existing router classes. The `.routes` attribute is used to template the URL patterns that will be mapped to each viewset. +The simplest way to implement a custom router is to subclass one of the existing router classes. The `.routes` attribute is used to template the URL patterns that will be mapped to each viewset. The `.routes` attribute is a list of `Route` named tuples. ## Example @@ -109,10 +109,18 @@ The following example will only route to the `list` and `retrieve` actions, and A router for read-only APIs, which doesn't use trailing suffixes. """ routes = [ - (r'^{prefix}$', {'get': 'list'}, '{basename}-list'), - (r'^{prefix}/{lookup}$', {'get': 'retrieve'}, '{basename}-detail') + Route(url=r'^{prefix}$', + mapping={'get': 'list'}, + name='{basename}-list', + initkwargs={}), + Route(url=r'^{prefix}/{lookup}$', + mapping={'get': 'retrieve'}, + name='{basename}-detail', + initkwargs={}) ] +The `SimpleRouter` class provides another example of setting the `.routes` attribute. + ## Advanced custom routers If you want to provide totally custom behavior, you can override `BaseRouter` and override the `get_urls(self)` method. The method should insect the registered viewsets and return a list of URL patterns. The registered prefix, viewset and basename tuples may be inspected by accessing the `self.registry` attribute. -- cgit v1.2.3 From 53dc98eefb5644e60495ca86c7424e669d0a86f1 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 1 Jul 2013 17:22:42 +0100 Subject: Added Django OAuth2 Consumer package --- docs/api-guide/authentication.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs') diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 8cf995b3..22c3297c 100755 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -355,6 +355,10 @@ HTTP digest authentication is a widely implemented scheme that was intended to r The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 support, and works with Python 2.7 and Python 3.3+. The package is maintained by [Evonove][evonove] and uses the excelllent [OAuthLib][oauthlib]. The package is well documented, and comes as a recommended alternative for OAuth 2.0 support. +## Django OAuth2 Consumer + +The [Django Oauth2 Consumer][doac] library from [Rediker Software][rediker] is another package that provides [OAuth2 support for REST framework][doac-rest-framework]. The package includes token scoping permissions on tokens, which allows finer-grained access to your API. + [cite]: http://jacobian.org/writing/rest-worst-practices/ [http401]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 [http403]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4 @@ -376,3 +380,6 @@ The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 supp [django-oauth-toolkit]: https://github.com/evonove/django-oauth-toolkit [evonove]: https://github.com/evonove/ [oauthlib]: https://github.com/idan/oauthlib +[doac]: https://github.com/Rediker-Software/doac +[rediker]: https://github.com/Rediker-Software +[doac-rest-framework]: https://github.com/Rediker-Software/doac/blob/master/docs/markdown/integrations.md -- cgit v1.2.3 From 8274ff7d9c692d27f926af7610a5a547ced09a2e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 1 Jul 2013 17:27:23 +0100 Subject: Capitalization on OAuth --- docs/api-guide/authentication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 22c3297c..768f156b 100755 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -357,7 +357,7 @@ The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 supp ## Django OAuth2 Consumer -The [Django Oauth2 Consumer][doac] library from [Rediker Software][rediker] is another package that provides [OAuth2 support for REST framework][doac-rest-framework]. The package includes token scoping permissions on tokens, which allows finer-grained access to your API. +The [Django OAuth2 Consumer][doac] library from [Rediker Software][rediker] is another package that provides [OAuth2 support for REST framework][doac-rest-framework]. The package includes token scoping permissions on tokens, which allows finer-grained access to your API. [cite]: http://jacobian.org/writing/rest-worst-practices/ [http401]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 -- cgit v1.2.3 From 8d410c4671fd4596089883e360f5d3e8f9e0f62b Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 1 Jul 2013 17:32:06 +0100 Subject: Tweak text --- docs/api-guide/authentication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 768f156b..390fba8c 100755 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -357,7 +357,7 @@ The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 supp ## Django OAuth2 Consumer -The [Django OAuth2 Consumer][doac] library from [Rediker Software][rediker] is another package that provides [OAuth2 support for REST framework][doac-rest-framework]. The package includes token scoping permissions on tokens, which allows finer-grained access to your API. +The [Django OAuth2 Consumer][doac] library from [Rediker Software][rediker] is another package that provides [OAuth 2.0 support for REST framework][doac-rest-framework]. The package includes token scoping permissions on tokens, which allows finer-grained access to your API. [cite]: http://jacobian.org/writing/rest-worst-practices/ [http401]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2 -- cgit v1.2.3 From e7529b4072274797daf5b886dbac4c0e65a65674 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 2 Jul 2013 16:22:22 +0100 Subject: Fix broken link by hacking around md->html translating --- docs/api-guide/authentication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 390fba8c..5d6e0d91 100755 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -382,4 +382,4 @@ The [Django OAuth2 Consumer][doac] library from [Rediker Software][rediker] is a [oauthlib]: https://github.com/idan/oauthlib [doac]: https://github.com/Rediker-Software/doac [rediker]: https://github.com/Rediker-Software -[doac-rest-framework]: https://github.com/Rediker-Software/doac/blob/master/docs/markdown/integrations.md +[doac-rest-framework]: https://github.com/Rediker-Software/doac/blob/master/docs/markdown/integrations.md# -- cgit v1.2.3 From e460180a4dd86ff74cc786aabfeeba1c31d17413 Mon Sep 17 00:00:00 2001 From: Rudolf Olah Date: Tue, 2 Jul 2013 13:20:25 -0400 Subject: #955 updated router docs with more information on the `Route` named tuple and its parameters. --- docs/api-guide/routers.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs') diff --git a/docs/api-guide/routers.md b/docs/api-guide/routers.md index feff0fbf..1fb15fae 100644 --- a/docs/api-guide/routers.md +++ b/docs/api-guide/routers.md @@ -100,6 +100,18 @@ Implementing a custom router isn't something you'd need to do very often, but it The simplest way to implement a custom router is to subclass one of the existing router classes. The `.routes` attribute is used to template the URL patterns that will be mapped to each viewset. The `.routes` attribute is a list of `Route` named tuples. +The arguments to the `Route` named tuple are: + +* `url`: The URL to be routed. There are format arguments available, defined in `SimpleRouter.get_urls`: + * `prefix` - The URL prefix to use for this set of routes. + * `lookup` - The lookup field used to match against a single instance. + * `trailing_slash` - the value of `.trailing_slash`. +* `mapping`: Mapping of HTTP method names to the object's methods +* `name`: The name of the URL as used in `reverse` calls. There are format arguments available, defined in `SimpleRouter.get_urls`: + * `basename` - The base to use for the URL names that are created. +* `initkwargs`: Any additional arguments to the view. + * `suffix` - reserved for identifying the viewset type, used when generating the breadcrumb links, e.g. `AccountViewSet` becomes `Account List` when `suffix='List'`. + ## Example The following example will only route to the `list` and `retrieve` actions, and does not use the trailing slash convention. -- cgit v1.2.3 From e969c96aa020047becd7a759a80e2fdc46b21170 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 2 Jul 2013 22:08:40 +0100 Subject: Added @omouse for work on #955 - thanks! :) --- docs/topics/credits.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs') diff --git a/docs/topics/credits.md b/docs/topics/credits.md index 94760c74..e6fb9134 100644 --- a/docs/topics/credits.md +++ b/docs/topics/credits.md @@ -144,6 +144,7 @@ The following people have helped make REST framework great. * David Sanders - [davesque] * Philip Douglas - [freakydug] * Igor Kalat - [trwired] +* Rudolf Olah - [omouse] Many thanks to everyone who's contributed to the project. @@ -324,3 +325,4 @@ You can also contact [@_tomchristie][twitter] directly on twitter. [davesque]: https://github.com/davesque [freakydug]: https://github.com/freakydug [trwired]: https://github.com/trwired +[omouse]: https://github.com/omouse -- cgit v1.2.3 From 03e0ce35fe497d52d1a332e98c44e42acbc8af75 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 2 Jul 2013 22:15:46 +0100 Subject: Added 'Documenting your API' section. Closes #616 --- docs/img/apiary.png | Bin 0 -> 55554 bytes docs/img/django-rest-swagger.png | Bin 0 -> 76945 bytes docs/img/rest-framework-docs.png | Bin 0 -> 76612 bytes docs/img/self-describing.png | Bin 0 -> 53953 bytes docs/index.md | 2 + docs/template.html | 1 + docs/topics/documenting-your-api.md | 108 +++++++++++++++++++++++++++++++++ docs/topics/rest-hypermedia-hateoas.md | 3 +- 8 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 docs/img/apiary.png create mode 100644 docs/img/django-rest-swagger.png create mode 100644 docs/img/rest-framework-docs.png create mode 100644 docs/img/self-describing.png create mode 100644 docs/topics/documenting-your-api.md (limited to 'docs') diff --git a/docs/img/apiary.png b/docs/img/apiary.png new file mode 100644 index 00000000..923d384e Binary files /dev/null and b/docs/img/apiary.png differ diff --git a/docs/img/django-rest-swagger.png b/docs/img/django-rest-swagger.png new file mode 100644 index 00000000..96a6b238 Binary files /dev/null and b/docs/img/django-rest-swagger.png differ diff --git a/docs/img/rest-framework-docs.png b/docs/img/rest-framework-docs.png new file mode 100644 index 00000000..736a0095 Binary files /dev/null and b/docs/img/rest-framework-docs.png differ diff --git a/docs/img/self-describing.png b/docs/img/self-describing.png new file mode 100644 index 00000000..ecbe4fe4 Binary files /dev/null and b/docs/img/self-describing.png differ diff --git a/docs/index.md b/docs/index.md index de4b01c6..99cd6b88 100644 --- a/docs/index.md +++ b/docs/index.md @@ -170,6 +170,7 @@ The API guide is your complete reference manual to all the functionality provide General guides to using REST framework. +* [Documenting your API][documenting-your-api] * [AJAX, CSRF & CORS][ajax-csrf-cors] * [Browser enhancements][browser-enhancements] * [The Browsable API][browsableapi] @@ -289,6 +290,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [status]: api-guide/status-codes.md [settings]: api-guide/settings.md +[documenting-your-api]: topics/documenting-your-api.md [ajax-csrf-cors]: topics/ajax-csrf-cors.md [browser-enhancements]: topics/browser-enhancements.md [browsableapi]: topics/browsable-api.md diff --git a/docs/template.html b/docs/template.html index 21771025..27bc1062 100644 --- a/docs/template.html +++ b/docs/template.html @@ -95,6 +95,7 @@