mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
commit
3f0f977b96
|
@ -128,7 +128,7 @@ Note that if your API doesn't include any object level permissions, you may opti
|
||||||
|
|
||||||
Returns the classes that should be used to filter the queryset. Defaults to returning the `filter_backends` attribute.
|
Returns the classes that should be used to filter the queryset. Defaults to returning the `filter_backends` attribute.
|
||||||
|
|
||||||
May be overridden to provide more complex behavior with filters, such as using different (or even exlusive) lists of filter_backends depending on different criteria.
|
May be overridden to provide more complex behavior with filters, such as using different (or even exclusive) lists of filter_backends depending on different criteria.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ An example of a view that uses `TemplateHTMLRenderer`:
|
||||||
|
|
||||||
class UserDetail(generics.RetrieveAPIView):
|
class UserDetail(generics.RetrieveAPIView):
|
||||||
"""
|
"""
|
||||||
A view that returns a templated HTML representations of a given user.
|
A view that returns a templated HTML representation of a given user.
|
||||||
"""
|
"""
|
||||||
queryset = User.objects.all()
|
queryset = User.objects.all()
|
||||||
renderer_classes = (TemplateHTMLRenderer,)
|
renderer_classes = (TemplateHTMLRenderer,)
|
||||||
|
|
|
@ -812,7 +812,7 @@ There are four methods that can be overridden, depending on what functionality y
|
||||||
|
|
||||||
* `.to_representation()` - Override this to support serialization, for read operations.
|
* `.to_representation()` - Override this to support serialization, for read operations.
|
||||||
* `.to_internal_value()` - Override this to support deserialization, for write operations.
|
* `.to_internal_value()` - Override this to support deserialization, for write operations.
|
||||||
* `.create()` and `.update()` - Overide either or both of these to support saving instances.
|
* `.create()` and `.update()` - Override either or both of these to support saving instances.
|
||||||
|
|
||||||
Because this class provides the same interface as the `Serializer` class, you can use it with the existing generic class based views exactly as you would for a regular `Serializer` or `ModelSerializer`.
|
Because this class provides the same interface as the `Serializer` class, you can use it with the existing generic class based views exactly as you would for a regular `Serializer` or `ModelSerializer`.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user