diff options
| author | Xavier Ordoquy | 2015-02-10 23:56:05 +0100 | 
|---|---|---|
| committer | Xavier Ordoquy | 2015-02-10 23:56:05 +0100 | 
| commit | ccb2b8ff691760e4e93f3905975b285cee8b67f8 (patch) | |
| tree | f841204e1818f09c91e062e4bdedefe2732c65c1 /api-guide | |
| parent | b0a1712ebd2eeb9dfe17d0e2f7e1abd7000cfa15 (diff) | |
| download | django-rest-framework-ccb2b8ff691760e4e93f3905975b285cee8b67f8.tar.bz2 | |
Update documentation
Diffstat (limited to 'api-guide')
| -rw-r--r-- | api-guide/fields/index.html | 6 | ||||
| -rw-r--r-- | api-guide/filtering/index.html | 4 | ||||
| -rw-r--r-- | api-guide/generic-views/index.html | 8 | ||||
| -rw-r--r-- | api-guide/parsers/index.html | 2 | ||||
| -rw-r--r-- | api-guide/routers/index.html | 4 | ||||
| -rw-r--r-- | api-guide/viewsets/index.html | 2 | 
6 files changed, 14 insertions, 12 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 @@ -554,6 +554,10 @@                      </li>                      <li> +                      <a href="#djangrestframework-recursive">djangrestframework-recursive</a> +                    </li> +                   +                    <li>                        <a href="#django-rest-framework-gis">django-rest-framework-gis</a>                      </li> @@ -978,6 +982,8 @@ def to_internal_value(self, data):  <p>The <a href="http://drf-compound-fields.readthedocs.org">drf-compound-fields</a> package provides "compound" serializer fields, such as lists of simple values, which can be described by other fields rather than serializers with the <code>many=True</code> 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.</p>  <h2 id="drf-extra-fields">DRF Extra Fields</h2>  <p>The <a href="https://github.com/Hipo/drf-extra-fields">drf-extra-fields</a> package provides extra serializer fields for REST framework, including <code>Base64ImageField</code> and <code>PointField</code> classes.</p> +<h2 id="djangrestframework-recursive">djangrestframework-recursive</h2> +<p>the <a href="https://github.com/heywbj/django-rest-framework-recursive">djangorestframework-recursive</a> package provides a <code>RecursiveField</code> for serializing and deserializing recursive structures</p>  <h2 id="django-rest-framework-gis">django-rest-framework-gis</h2>  <p>The <a href="https://github.com/djangonauts/django-rest-framework-gis">django-rest-framework-gis</a> package provides geographic addons for django rest framework like a  <code>GeometryField</code> field and a GeoJSON serializer.</p>  <h2 id="django-rest-framework-hstore">django-rest-framework-hstore</h2> 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):  <p>The <code>ordering</code> attribute may be either a string or a list/tuple of strings.</p>  <hr />  <h2 id="djangoobjectpermissionsfilter">DjangoObjectPermissionsFilter</h2> -<p>The <code>DjangoObjectPermissionsFilter</code> is intended to be used together with the <a href="http://pythonhosted.org/django-guardian/"><code>django-guardian</code></a> package, with custom <code>'view'</code> permissions added.  The filter will ensure that querysets only returns objects for which the user has the appropriate view permission.</p> +<p>The <code>DjangoObjectPermissionsFilter</code> is intended to be used together with the <a href="https://django-guardian.readthedocs.org/"><code>django-guardian</code></a> package, with custom <code>'view'</code> permissions added.  The filter will ensure that querysets only returns objects for which the user has the appropriate view permission.</p>  <p>This filter class must be used with views that provide either a <code>queryset</code> or a <code>model</code> attribute.</p>  <p>If you're using <code>DjangoObjectPermissionsFilter</code>, 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 <code>DjangoObjectPermissions</code> and add <code>'view'</code> permissions to the <code>perms_map</code> attribute.</p>  <p>A complete example using both <code>DjangoObjectPermissionsFilter</code> and <code>DjangoObjectPermissions</code> might look something like this.</p> @@ -739,7 +739,7 @@ class ProductFilter(django_filters.FilterSet):      filter_backends = (filters.DjangoObjectPermissionsFilter,)      permission_classes = (myapp.permissions.CustomObjectPermissions,)  </code></pre> -<p>For more information on adding <code>'view'</code> permissions for models, see the <a href="http://pythonhosted.org/django-guardian/userguide/assign.html">relevant section</a> of the <code>django-guardian</code> documentation, and <a href="http://blog.nyaruka.com/adding-a-view-permission-to-django-models">this blogpost</a>.</p> +<p>For more information on adding <code>'view'</code> permissions for models, see the <a href="https://django-guardian.readthedocs.org/en/latest/userguide/assign.html">relevant section</a> of the <code>django-guardian</code> documentation, and <a href="http://blog.nyaruka.com/adding-a-view-permission-to-django-models">this blogpost</a>.</p>  <hr />  <h1 id="custom-generic-filtering">Custom generic filtering</h1>  <p>You can also provide your own generic filtering backend, or write an installable app for other developers to use.</p> 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):  <ul>  <li><code>filter_backends</code> - A list of filter backend classes that should be used for filtering the queryset.  Defaults to the same value as the <code>DEFAULT_FILTER_BACKENDS</code> setting.</li>  </ul> -<p><strong>Deprecated attributes</strong>:</p> -<ul> -<li><code>model</code> - This shortcut may be used instead of setting either (or both) of the <code>queryset</code>/<code>serializer_class</code> attributes. The explicit style is preferred over the <code>.model</code> shortcut, and usage of this attribute is now deprecated.</li> -</ul>  <h3 id="methods">Methods</h3>  <p><strong>Base methods</strong>:</p>  <h4 id="get_querysetself"><code>get_queryset(self)</code></h4> -<p>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 <code>queryset</code> attribute, or the default queryset for the model if the <code>model</code> shortcut is being used.</p> +<p>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 <code>queryset</code> attribute.</p>  <p>This method should always be used rather than accessing <code>self.queryset</code> directly, as <code>self.queryset</code> gets evaluated only once, and those results are cached for all subsequent requests.</p>  <p>May be overridden to provide dynamic behavior, such as returning a queryset, that is specific to the user making the request.</p>  <p>For example:</p> @@ -620,7 +616,7 @@ class UserList(generics.ListCreateAPIView):      return (CategoryFilter,)  </code></pre>  <h4 id="get_serializer_classself"><code>get_serializer_class(self)</code></h4> -<p>Returns the class that should be used for the serializer.  Defaults to returning the <code>serializer_class</code> attribute, or dynamically generating a serializer class if the <code>model</code> shortcut is being used.</p> +<p>Returns the class that should be used for the serializer.  Defaults to returning the <code>serializer_class</code> attribute.</p>  <p>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.</p>  <p>For example:</p>  <pre><code>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)  </code></pre> 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  </ul>  <p>Optionally, you may also specify an additional argument:</p>  <ul> -<li><code>base_name</code> - The base to use for the URL names that are created.  If unset the basename will be automatically generated based on the <code>model</code> or <code>queryset</code> attribute on the viewset, if it has one.  Note that if the viewset does not include a <code>model</code> or <code>queryset</code> attribute then you must set <code>base_name</code> when registering the viewset.</li> +<li><code>base_name</code> - The base to use for the URL names that are created.  If unset the basename will be automatically generated based on the <code>queryset</code> attribute of the viewset, if it has one.  Note that if the viewset does not include a <code>queryset</code> attribute then you must set <code>base_name</code> when registering the viewset.</li>  </ul>  <p>The example above would generate the following URL patterns:</p>  <ul> @@ -534,7 +534,7 @@ class UserViewSet(ModelViewSet):  <ul>  <li>URL pattern: <code>^users/{pk}/change-password/$</code>  Name: <code>'user-change-password'</code></li>  </ul> -<p>For more information see the viewset documentation on <a href="../../viewsets.html#marking-extra-actions-for-routing">marking extra actions for routing</a>.</p> +<p>For more information see the viewset documentation on <a href="../viewsets#marking-extra-actions-for-routing">marking extra actions for routing</a>.</p>  <h1 id="api-guide">API Guide</h1>  <h2 id="simplerouter">SimpleRouter</h2>  <p>This router includes routes for the standard set of <code>list</code>, <code>create</code>, <code>retrieve</code>, <code>update</code>, <code>partial_update</code> and <code>destroy</code> actions.  The viewset can also mark additional methods to be routed, using the <code>@detail_route</code> or <code>@list_route</code> decorators.</p> diff --git a/api-guide/viewsets/index.html b/api-guide/viewsets/index.html index 13debab3..7029dc8d 100644 --- a/api-guide/viewsets/index.html +++ b/api-guide/viewsets/index.html @@ -587,7 +587,7 @@ class UserViewSet(viewsets.ModelViewSet):      def get_queryset(self):          return self.request.user.accounts.all()  </code></pre> -<p>Note however that upon removal of the <code>queryset</code> property from your <code>ViewSet</code>, any associated <a href="../routers">router</a> will be unable to derive the base_name of your Model automatically, and so you you will have to specify the <code>base_name</code> kwarg as part of your <a href="../routers">router registration</a>.</p> +<p>Note however that upon removal of the <code>queryset</code> property from your <code>ViewSet</code>, any associated <a href="../routers">router</a> will be unable to derive the base_name of your Model automatically, and so you will have to specify the <code>base_name</code> kwarg as part of your <a href="../routers">router registration</a>.</p>  <p>Also note that although this class provides the complete set of create/list/retrieve/update/destroy actions by default, you can restrict the available operations by using the standard permission classes.</p>  <h2 id="readonlymodelviewset">ReadOnlyModelViewSet</h2>  <p>The <code>ReadOnlyModelViewSet</code> class also inherits from <code>GenericAPIView</code>.  As with <code>ModelViewSet</code> it also includes implementations for various actions, but unlike <code>ModelViewSet</code> only provides the 'read-only' actions, <code>.list()</code> and <code>.retrieve()</code>.</p> | 
