From 1b35c1908f9b58af91334832c1bc4839b33ce8a8 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 8 Oct 2012 14:13:40 +0100 Subject: [PATCH] Add RetrieveDestroyAPIView and remove Metadata mixin --- api-guide/generic-views.html | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/api-guide/generic-views.html b/api-guide/generic-views.html index c6d6194c3..40eb204ec 100644 --- a/api-guide/generic-views.html +++ b/api-guide/generic-views.html @@ -115,6 +115,7 @@
  • ListAPIView
  • ListCreateAPIView
  • RetrieveAPIView
  • +
  • RetrieveDestroyAPIView
  • RetrieveUpdateDestroyAPIView
  • Base views
  • BaseAPIView
  • @@ -170,20 +171,25 @@

    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.

    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.

    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.

    Extends: SingleObjectBaseAPIView, RetrieveModelMixin, UpdateModelMixin, DestroyModelMixin


    @@ -202,14 +208,19 @@

    The mixin classes provide the actions that are used to provide the basic view behaviour. 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 behaviour.

    ListModelMixin

    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.