diff --git a/api-guide/generic-views.html b/api-guide/generic-views.html index 33927ff0d..4534f0596 100644 --- a/api-guide/generic-views.html +++ b/api-guide/generic-views.html @@ -95,6 +95,23 @@
Django’s generic views... were developed as a shortcut for common usage patterns... They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to repeat yourself.
+One of the key benefits of class based views is the way they allow you to compose bits of reusable behaviour. REST framework takes advantage of this by providing a number of pre-built views that provide for commonly used patterns.
+...
+Used for read-write endpoints to represent a collection of model instances.
+Provides a get
method handler.
Used for read-write endpoints to represent a collection of model instances.
+Provides get
and post
method handlers.
Used for read-only endpoints to represent a single model instance.
+Provides a get
method handler.
Used for read-write endpoints to represent a single model instance.
+Provides get
, put
and delete
method handlers.
Extends REST framework's APIView
class, adding support for serialization of model instances and model querysets.
Provides a base view for acting on a single object, by combining REST framework's APIView
, and Django's MultipleObjectMixin.
See also: ccbv.co.uk documentation for MultipleObjectMixin.
+Provides a base view for acting on a single object, by combining REST framework's APIView
, and Django's SingleObjectMixin.
See also: ccbv.co.uk documentation for SingleObjectMixin.
+The mixin classes provide the actions that are used
+Provides a .list(request, *args, **kwargs)
method, that implements listing a queryset.
Provides a .create(request, *args, **kwargs)
method, that implements creating and saving a new model instance.
Provides a .retrieve(request, *args, **kwargs)
method, that implements returning an existing model instance in a response.
Provides a .update(request, *args, **kwargs)
method, that implements updating and saving an existing model instance.
Provides a .destroy(request, *args, **kwargs)
method, that implements deletion of an existing model instance.
Provides a .metadata(request, *args, **kwargs)
method, that returns a response containing metadata about the view.
Ensures that any Response
object returned from the handler method will be rendered into the correct content type, as determined by the content negotation.
You won't typically need to override this method.
+Saying [that Class based views] is always the superior solution is a mistake.