aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide/generic-views.md
diff options
context:
space:
mode:
authorTom Christie2012-10-08 14:13:15 +0100
committerTom Christie2012-10-08 14:13:15 +0100
commitf79ed6175df62f68dba9179f792f95b6ac6dca14 (patch)
treea8c173b79405a820d170f4f938a566fac3e137a2 /docs/api-guide/generic-views.md
parent52ba2e333375c6829fb89b6b43e4d19b2f2a86a4 (diff)
downloaddjango-rest-framework-f79ed6175df62f68dba9179f792f95b6ac6dca14.tar.bz2
Add RetrieveDestroyAPIView and remove Metadata mixin
Diffstat (limited to 'docs/api-guide/generic-views.md')
-rw-r--r--docs/api-guide/generic-views.md29
1 files changed, 25 insertions, 4 deletions
diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md
index 571cc66f..8bf7a7e2 100644
--- a/docs/api-guide/generic-views.md
+++ b/docs/api-guide/generic-views.md
@@ -47,9 +47,11 @@ For very simple cases you might want to pass through any class attributes using
# API Reference
+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.
+
## ListAPIView
-Used for read-only endpoints to represent a collection of model instances.
+Used for **read-only** endpoints to represent a **collection of model instances**.
Provides a `get` method handler.
@@ -57,7 +59,7 @@ Extends: [MultipleObjectBaseAPIView], [ListModelMixin]
## ListCreateAPIView
-Used for read-write endpoints to represent a collection of model instances.
+Used for **read-write** endpoints to represent a **collection of model instances**.
Provides `get` and `post` method handlers.
@@ -65,15 +67,23 @@ Extends: [MultipleObjectBaseAPIView], [ListModelMixin], [CreateModelMixin]
## RetrieveAPIView
-Used for read-only endpoints to represent a single model instance.
+Used for **read-only** endpoints to represent a **single model instance**.
Provides a `get` method handler.
Extends: [SingleObjectBaseAPIView], [RetrieveModelMixin]
+## RetrieveDestroyAPIView
+
+Used for **read or delete** endpoints to represent a **single model instance**.
+
+Provides `get` and `delete` method handlers.
+
+Extends: [SingleObjectBaseAPIView], [RetrieveModelMixin], [DestroyModelMixin]
+
## RetrieveUpdateDestroyAPIView
-Used for read-write endpoints to represent a single model instance.
+Used for **read-write** endpoints to represent a **single model instance**.
Provides `get`, `put` and `delete` method handlers.
@@ -111,28 +121,39 @@ The mixin classes provide the actions that are used to provide the basic view be
Provides a `.list(request, *args, **kwargs)` method, that implements listing a queryset.
+Should be mixed in with [MultipleObjectBaseAPIView].
+
## CreateModelMixin
Provides a `.create(request, *args, **kwargs)` method, that implements creating and saving a new model instance.
+Should be mixed in with any [BaseAPIView].
+
## RetrieveModelMixin
Provides a `.retrieve(request, *args, **kwargs)` method, that implements returning an existing model instance in a response.
+Should be mixed in with [SingleObjectBaseAPIView].
+
## UpdateModelMixin
Provides a `.update(request, *args, **kwargs)` method, that implements updating and saving an existing model instance.
+Should be mixed in with [SingleObjectBaseAPIView].
+
## DestroyModelMixin
Provides a `.destroy(request, *args, **kwargs)` method, that implements deletion of an existing model instance.
+Should be mixed in with [SingleObjectBaseAPIView].
+
[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/
+[BaseAPIView]: #baseapiview
[SingleObjectBaseAPIView]: #singleobjectbaseapiview
[MultipleObjectBaseAPIView]: #multipleobjectbaseapiview
[ListModelMixin]: #listmodelmixin