diff options
| author | Tom Christie | 2015-02-06 14:35:06 +0000 | 
|---|---|---|
| committer | Tom Christie | 2015-02-06 14:35:06 +0000 | 
| commit | 3dff9a4fe2952cf632ca7f4cd9ecf4221059ca91 (patch) | |
| tree | 0649d42b20b875e97cb551b987644b61e7860e84 /docs/api-guide/generic-views.md | |
| parent | c06a82d0531f4cb290baacee196829c770913eaa (diff) | |
| parent | 1f996128458570a909d13f15c3d739fb12111984 (diff) | |
| download | django-rest-framework-3dff9a4fe2952cf632ca7f4cd9ecf4221059ca91.tar.bz2 | |
Resolve merge conflictmodel-serializer-caching
Diffstat (limited to 'docs/api-guide/generic-views.md')
| -rwxr-xr-x | docs/api-guide/generic-views.md | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md index f5bbdfdd..61c8e8d8 100755 --- a/docs/api-guide/generic-views.md +++ b/docs/api-guide/generic-views.md @@ -93,17 +93,13 @@ The following attributes are used to control pagination when used with list view  * `filter_backends` - A list of filter backend classes that should be used for filtering the queryset.  Defaults to the same value as the `DEFAULT_FILTER_BACKENDS` setting. -**Deprecated attributes**: - -* `model` - This shortcut may be used instead of setting either (or both) of the `queryset`/`serializer_class` attributes. The explicit style is preferred over the `.model` shortcut, and usage of this attribute is now deprecated. -  ### 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. @@ -153,7 +149,7 @@ For example:  #### `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. @@ -214,6 +210,8 @@ You won't typically need to override the following methods, although you might n  The mixin classes provide the actions that are used to provide the basic view behavior.  Note that the mixin classes provide action methods rather than defining the handler methods, such as `.get()` and `.post()`, directly.  This allows for more flexible composition of behavior. +The mixin classes can be imported from `rest_framework.mixins`. +  ## ListModelMixin  Provides a `.list(request, *args, **kwargs)` method, that implements listing a queryset. @@ -258,6 +256,8 @@ If an object is deleted this returns a `204 No Content` response, otherwise it w  The following classes are the concrete generic views.  If you're using generic views this is normally the level you'll be working at unless you need heavily customized behavior. +The view classes can be imported from `rest_framework.generics`. +  ## CreateAPIView  Used for **create-only** endpoints. | 
