aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/generic-views.md
diff options
context:
space:
mode:
authorTom Christie2012-10-02 11:48:25 +0100
committerTom Christie2012-10-02 11:48:25 +0100
commit8855a462c606c4cb08a86269c1f46dc2b30fc1ac (patch)
tree2ab6f643a24207021cf499c10af3351a5dc16261 /docs/api-guide/generic-views.md
parentb526b82abf4be55faa7610bdeeefa340f84ad2d1 (diff)
downloaddjango-rest-framework-8855a462c606c4cb08a86269c1f46dc2b30fc1ac.tar.bz2
Clean up docs slightly
Diffstat (limited to 'docs/api-guide/generic-views.md')
-rw-r--r--docs/api-guide/generic-views.md88
1 files changed, 88 insertions, 0 deletions
diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md
index 202875a4..88f245c7 100644
--- a/docs/api-guide/generic-views.md
+++ b/docs/api-guide/generic-views.md
@@ -7,4 +7,92 @@
>
> — [Django Documentation][cite]
+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.
+
+## Example
+
+...
+
+---
+
+# API Reference
+
+## ListAPIView
+
+Used for read-write endpoints to represent a collection of model instances.
+
+Provides a `get` method handler.
+
+## ListCreateAPIView
+
+Used for read-write endpoints to represent a collection of model instances.
+
+Provides `get` and `post` method handlers.
+
+## RetrieveAPIView
+
+Used for read-only endpoints to represent a single model instance.
+
+Provides a `get` method handler.
+
+## RetrieveUpdateDestroyAPIView
+
+Used for read-write endpoints to represent a single model instance.
+
+Provides `get`, `put` and `delete` method handlers.
+
+---
+
+# Base views
+
+## BaseAPIView
+
+Extends REST framework's `APIView` class, adding support for serialization of model instances and model querysets.
+
+## MultipleObjectBaseAPIView
+
+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][multiple-object-mixin-classy].
+
+## SingleObjectBaseAPIView
+
+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][single-object-mixin-classy].
+
+---
+
+# Mixins
+
+The mixin classes provide the actions that are used
+
+## ListModelMixin
+
+Provides a `.list(request, *args, **kwargs)` method, that implements listing a queryset.
+
+## CreateModelMixin
+
+Provides a `.create(request, *args, **kwargs)` method, that implements creating and saving a new model instance.
+
+## RetrieveModelMixin
+
+Provides a `.retrieve(request, *args, **kwargs)` method, that implements returning an existing model instance in a response.
+
+## UpdateModelMixin
+
+Provides a `.update(request, *args, **kwargs)` method, that implements updating and saving an existing model instance.
+
+## DestroyModelMixin
+
+Provides a `.destroy(request, *args, **kwargs)` method, that implements deletion of an existing model instance.
+
+## MetadataMixin
+
+Provides a `.metadata(request, *args, **kwargs)` method, that returns a response containing metadata about the view.
+
[cite]: https://docs.djangoproject.com/en/dev/ref/class-based-views/#base-vs-generic-views
+[MultipleObjectMixin]: https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-multiple-object/
+[SingleObjectMixin]: https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-single-object/
+[multiple-object-mixin-classy]: http://ccbv.co.uk/projects/Django/1.4/django.views.generic.list/MultipleObjectMixin/
+[single-object-mixin-classy]: http://ccbv.co.uk/projects/Django/1.4/django.views.generic.detail/SingleObjectMixin/