diff options
| -rw-r--r-- | api-guide/authentication.html | 6 | ||||
| -rw-r--r-- | api-guide/filtering.html | 8 | ||||
| -rw-r--r-- | api-guide/routers.html | 10 | ||||
| -rw-r--r-- | topics/release-notes.html | 1 |
4 files changed, 20 insertions, 5 deletions
diff --git a/api-guide/authentication.html b/api-guide/authentication.html index 0b869df5..b0745359 100644 --- a/api-guide/authentication.html +++ b/api-guide/authentication.html @@ -335,10 +335,12 @@ print token.key <hr /> <h4 id="generating-tokens">Generating Tokens</h4> <p>If you want every user to have an automatically generated Token, you can simply catch the User's <code>post_save</code> signal.</p> -<pre class="prettyprint lang-py"><code>from django.dispatch import receiver +<pre class="prettyprint lang-py"><code>from django.contrib.auth import get_user_model +from django.db.models.signals import post_save +from django.dispatch import receiver from rest_framework.authtoken.models import Token -@receiver(post_save, sender=User) +@receiver(post_save, sender=get_user_model()) def create_auth_token(sender, instance=None, created=False, **kwargs): if created: Token.objects.create(user=instance) diff --git a/api-guide/filtering.html b/api-guide/filtering.html index b367053b..4921927a 100644 --- a/api-guide/filtering.html +++ b/api-guide/filtering.html @@ -6,7 +6,7 @@ <link href="http://django-rest-framework.org/img/favicon.ico" rel="icon" type="image/x-icon"> <link rel="canonical" href="http://django-rest-framework.org/api-guide/filtering"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="description" content="Django, API, REST, Filtering, Generic Filtering, API Guide, Custom generic filtering"> + <meta name="description" content="Django, API, REST, Filtering, Generic Filtering, API Guide, Custom generic filtering, Third party packages"> <meta name="author" content="Tom Christie"> <!-- Le styles --> @@ -183,6 +183,8 @@ <li><a href="#djangoobjectpermissionsfilter">DjangoObjectPermissionsFilter</a></li> <li class="main"><a href="#custom-generic-filtering">Custom generic filtering</a></li> <li><a href="#example">Example</a></li> +<li class="main"><a href="#third-party-packages">Third party packages</a></li> +<li><a href="#django-rest-framework-chain">Django REST framework chain</a></li> <div> <hr> @@ -495,6 +497,10 @@ class ProductFilter(django_filters.FilterSet): return queryset.filter(owner=request.user) </code></pre> <p>We could achieve the same behavior by overriding <code>get_queryset()</code> on the views, but using a filter backend allows you to more easily add this restriction to multiple views, or to apply it across the entire API.</p> +<h1 id="third-party-packages">Third party packages</h1> +<p>The following third party packages provide additional filter implementations.</p> +<h2 id="django-rest-framework-chain">Django REST framework chain</h2> +<p>The <a href="https://github.com/philipn/django-rest-framework-chain">django-rest-framework-chain package</a> works together with the <code>DjangoFilterBackend</code> class, and allows you to easily create filters across relationships, or create multiple filter lookup types for a given field.</p> </div><!--/span--> </div><!--/row--> </div><!--/.fluid-container--> diff --git a/api-guide/routers.html b/api-guide/routers.html index 458f1f34..2ff48672 100644 --- a/api-guide/routers.html +++ b/api-guide/routers.html @@ -6,7 +6,7 @@ <link href="http://django-rest-framework.org/img/favicon.ico" rel="icon" type="image/x-icon"> <link rel="canonical" href="http://django-rest-framework.org/api-guide/routers"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="description" content="Django, API, REST, Routers, API Guide, Custom Routers"> + <meta name="description" content="Django, API, REST, Routers, API Guide, Custom Routers, Third Party Packages"> <meta name="author" content="Tom Christie"> <!-- Le styles --> @@ -176,6 +176,8 @@ <li class="main"><a href="#custom-routers">Custom Routers</a></li> <li><a href="#example">Example</a></li> <li><a href="#advanced-custom-routers">Advanced custom routers</a></li> +<li class="main"><a href="#third-party-packages">Third Party Packages</a></li> +<li><a href="#drf-nested-routers">DRF Nested Routers</a></li> <div> <hr> @@ -216,7 +218,7 @@ <p>Some Web frameworks such as Rails provide functionality for automatically determining how the URLs for an application should be mapped to the logic that deals with handling incoming requests.</p> <p>REST framework adds support for automatic URL routing to Django, and provides you with a simple, quick and consistent way of wiring your view logic to a set of URLs.</p> <h2 id="usage">Usage</h2> -<p>Here's an example of a simple URL conf, that uses <code>DefaultRouter</code>.</p> +<p>Here's an example of a simple URL conf, that uses <code>SimpleRouter</code>.</p> <pre class="prettyprint lang-py"><code>from rest_framework import routers router = routers.SimpleRouter() @@ -331,6 +333,10 @@ class ReadOnlyRouter(SimpleRouter): <h2 id="advanced-custom-routers">Advanced custom routers</h2> <p>If you want to provide totally custom behavior, you can override <code>BaseRouter</code> and override the <code>get_urls(self)</code> method. The method should inspect the registered viewsets and return a list of URL patterns. The registered prefix, viewset and basename tuples may be inspected by accessing the <code>self.registry</code> attribute. </p> <p>You may also want to override the <code>get_default_base_name(self, viewset)</code> method, or else always explicitly set the <code>base_name</code> argument when registering your viewsets with the router.</p> +<h1 id="third-party-packages">Third Party Packages</h1> +<p>The following third party packages provide router implementations that extend the default functionality provided by REST framework.</p> +<h2 id="drf-nested-routers">DRF Nested Routers</h2> +<p>The <a href="https://github.com/alanjds/drf-nested-routers">drf-nested-routers package</a> provides routers and relationship fields for working with nested resources.</p> </div><!--/span--> </div><!--/row--> </div><!--/.fluid-container--> diff --git a/topics/release-notes.html b/topics/release-notes.html index 2f8fe69c..b3f7b225 100644 --- a/topics/release-notes.html +++ b/topics/release-notes.html @@ -247,6 +247,7 @@ <h3 id="master">Master</h3> <ul> <li>JSON renderer now deals with objects that implement a dict-like interface.</li> +<li>Bugfix: Refine behavior that calls model manager <code>all()</code> across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.</li> </ul> <h3 id="2310">2.3.10</h3> <p><strong>Date</strong>: 6th December 2013</p> |
