diff --git a/api-guide/authentication.html b/api-guide/authentication.html index 0b869df54..b07453590 100644 --- a/api-guide/authentication.html +++ b/api-guide/authentication.html @@ -335,10 +335,12 @@ print token.key
If you want every user to have an automatically generated Token, you can simply catch the User's post_save
signal.
from django.dispatch import receiver
+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 b367053ba..4921927a5 100644
--- a/api-guide/filtering.html
+++ b/api-guide/filtering.html
@@ -6,7 +6,7 @@
-
+
@@ -183,6 +183,8 @@
DjangoObjectPermissionsFilter
Custom generic filtering
Example
+Third party packages
+Django REST framework chain
@@ -495,6 +497,10 @@ class ProductFilter(django_filters.FilterSet):
return queryset.filter(owner=request.user)
We could achieve the same behavior by overriding get_queryset()
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.
+Third party packages
+The following third party packages provide additional filter implementations.
+Django REST framework chain
+The django-rest-framework-chain package works together with the DjangoFilterBackend
class, and allows you to easily create filters across relationships, or create multiple filter lookup types for a given field.
diff --git a/api-guide/routers.html b/api-guide/routers.html
index 458f1f34e..2ff486720 100644
--- a/api-guide/routers.html
+++ b/api-guide/routers.html
@@ -6,7 +6,7 @@
-
+
@@ -176,6 +176,8 @@
Custom Routers
Example
Advanced custom routers
+Third Party Packages
+DRF Nested Routers
@@ -216,7 +218,7 @@
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.
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.
Usage
-Here's an example of a simple URL conf, that uses DefaultRouter
.
+Here's an example of a simple URL conf, that uses SimpleRouter
.
from rest_framework import routers
router = routers.SimpleRouter()
@@ -331,6 +333,10 @@ class ReadOnlyRouter(SimpleRouter):
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 inspect 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.
You may also want to override the get_default_base_name(self, viewset)
method, or else always explicitly set the base_name
argument when registering your viewsets with the router.
+Third Party Packages
+The following third party packages provide router implementations that extend the default functionality provided by REST framework.
+DRF Nested Routers
+The drf-nested-routers package provides routers and relationship fields for working with nested resources.
diff --git a/topics/release-notes.html b/topics/release-notes.html
index 2f8fe69c8..b3f7b2253 100644
--- a/topics/release-notes.html
+++ b/topics/release-notes.html
@@ -247,6 +247,7 @@
Master
- JSON renderer now deals with objects that implement a dict-like interface.
+- Bugfix: Refine behavior that calls model manager
all()
across nested serializer relationships, preventing erronous behavior with some non-ORM objects, and preventing unneccessary queryset re-evaluations.
2.3.10
Date: 6th December 2013