From ccb2b8ff691760e4e93f3905975b285cee8b67f8 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Tue, 10 Feb 2015 23:56:05 +0100 Subject: Update documentation --- api-guide/fields/index.html | 6 ++++++ api-guide/filtering/index.html | 4 ++-- api-guide/generic-views/index.html | 8 ++------ api-guide/parsers/index.html | 2 +- api-guide/routers/index.html | 4 ++-- api-guide/viewsets/index.html | 2 +- topics/3.0-announcement/index.html | 4 ++-- topics/release-notes/index.html | 15 ++++++++++++++- topics/third-party-resources/index.html | 2 +- tutorial/1-serialization/index.html | 2 +- tutorial/2-requests-and-responses/index.html | 2 +- tutorial/5-relationships-and-hyperlinked-apis/index.html | 2 +- 12 files changed, 34 insertions(+), 19 deletions(-) diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html index 83affe26..9fd73553 100644 --- a/api-guide/fields/index.html +++ b/api-guide/fields/index.html @@ -553,6 +553,10 @@ DRF Extra Fields +
  • + djangrestframework-recursive +
  • +
  • django-rest-framework-gis
  • @@ -978,6 +982,8 @@ def to_internal_value(self, data):

    The drf-compound-fields package provides "compound" serializer fields, such as lists of simple values, which can be described by other fields rather than serializers with the many=True option. Also provided are fields for typed dictionaries and values that can be either a specific type or a list of items of that type.

    DRF Extra Fields

    The drf-extra-fields package provides extra serializer fields for REST framework, including Base64ImageField and PointField classes.

    +

    djangrestframework-recursive

    +

    the djangorestframework-recursive package provides a RecursiveField for serializing and deserializing recursive structures

    django-rest-framework-gis

    The django-rest-framework-gis package provides geographic addons for django rest framework like a GeometryField field and a GeoJSON serializer.

    django-rest-framework-hstore

    diff --git a/api-guide/filtering/index.html b/api-guide/filtering/index.html index 374c0a5d..7cf57f6b 100644 --- a/api-guide/filtering/index.html +++ b/api-guide/filtering/index.html @@ -708,7 +708,7 @@ class ProductFilter(django_filters.FilterSet):

    The ordering attribute may be either a string or a list/tuple of strings.


    DjangoObjectPermissionsFilter

    -

    The DjangoObjectPermissionsFilter is intended to be used together with the django-guardian package, with custom 'view' permissions added. The filter will ensure that querysets only returns objects for which the user has the appropriate view permission.

    +

    The DjangoObjectPermissionsFilter is intended to be used together with the django-guardian package, with custom 'view' permissions added. The filter will ensure that querysets only returns objects for which the user has the appropriate view permission.

    This filter class must be used with views that provide either a queryset or a model attribute.

    If you're using DjangoObjectPermissionsFilter, you'll probably also want to add an appropriate object permissions class, to ensure that users can only operate on instances if they have the appropriate object permissions. The easiest way to do this is to subclass DjangoObjectPermissions and add 'view' permissions to the perms_map attribute.

    A complete example using both DjangoObjectPermissionsFilter and DjangoObjectPermissions might look something like this.

    @@ -739,7 +739,7 @@ class ProductFilter(django_filters.FilterSet): filter_backends = (filters.DjangoObjectPermissionsFilter,) permission_classes = (myapp.permissions.CustomObjectPermissions,) -

    For more information on adding 'view' permissions for models, see the relevant section of the django-guardian documentation, and this blogpost.

    +

    For more information on adding 'view' permissions for models, see the relevant section of the django-guardian documentation, and this blogpost.


    Custom generic filtering

    You can also provide your own generic filtering backend, or write an installable app for other developers to use.

    diff --git a/api-guide/generic-views/index.html b/api-guide/generic-views/index.html index 675220d7..082f0bb0 100644 --- a/api-guide/generic-views/index.html +++ b/api-guide/generic-views/index.html @@ -577,14 +577,10 @@ class UserList(generics.ListCreateAPIView): -

    Deprecated attributes:

    -

    Methods

    Base methods:

    get_queryset(self)

    -

    Returns the queryset that should be used for list views, and that should be used as the base for lookups in detail views. Defaults to returning the queryset specified by the queryset attribute, or the default queryset for the model if the model shortcut is being used.

    +

    Returns the queryset that should be used for list views, and that should be used as the base for lookups in detail views. Defaults to returning the queryset specified by the queryset attribute.

    This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

    May be overridden to provide dynamic behavior, such as returning a queryset, that is specific to the user making the request.

    For example:

    @@ -620,7 +616,7 @@ class UserList(generics.ListCreateAPIView): return (CategoryFilter,)

    get_serializer_class(self)

    -

    Returns the class that should be used for the serializer. Defaults to returning the serializer_class attribute, or dynamically generating a serializer class if the model shortcut is being used.

    +

    Returns the class that should be used for the serializer. Defaults to returning the serializer_class attribute.

    May be overridden to provide dynamic behavior, such as using different serializers for read and write operations, or providing different serializers to different types of users.

    For example:

    def get_serializer_class(self):
    diff --git a/api-guide/parsers/index.html b/api-guide/parsers/index.html
    index 116b63da..e04f563e 100644
    --- a/api-guide/parsers/index.html
    +++ b/api-guide/parsers/index.html
    @@ -543,7 +543,7 @@ def example_view(request, format=None):
         def put(self, request, filename, format=None):
             file_obj = request.data['file']
             # ...
    -        # do some staff with uploaded file
    +        # do some stuff with uploaded file
             # ...
             return Response(status=204)
     
    diff --git a/api-guide/routers/index.html b/api-guide/routers/index.html index 4e27a86a..80bf512d 100644 --- a/api-guide/routers/index.html +++ b/api-guide/routers/index.html @@ -459,7 +459,7 @@ urlpatterns = router.urls

    Optionally, you may also specify an additional argument:

    The example above would generate the following URL patterns: