Commit e198a2b3 by Stephan Groß

added RetrieveUpdateAPIView

parent 497da7fc
...@@ -97,6 +97,14 @@ Provides `get` and `post` method handlers. ...@@ -97,6 +97,14 @@ Provides `get` and `post` method handlers.
Extends: [MultipleObjectAPIView], [ListModelMixin], [CreateModelMixin] Extends: [MultipleObjectAPIView], [ListModelMixin], [CreateModelMixin]
## RetrieveUpdateAPIView
Used for **read or update** endpoints to represent a **single model instance**.
Provides `get` and `put` method handlers.
Extends: [SingleObjectAPIView], [RetrieveModelMixin], [UpdateModelMixin]
## RetrieveDestroyAPIView ## RetrieveDestroyAPIView
Used for **read or delete** endpoints to represent a **single model instance**. Used for **read or delete** endpoints to represent a **single model instance**.
......
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
> >
> — Eric S. Raymond, [The Cathedral and the Bazaar][cite]. > — Eric S. Raymond, [The Cathedral and the Bazaar][cite].
## Master
* Added `RetrieveUpdateAPIView`
## 2.1.9 ## 2.1.9
**Date**: 11th Dec 2012 **Date**: 11th Dec 2012
......
...@@ -185,6 +185,18 @@ class ListCreateAPIView(mixins.ListModelMixin, ...@@ -185,6 +185,18 @@ class ListCreateAPIView(mixins.ListModelMixin,
return self.create(request, *args, **kwargs) return self.create(request, *args, **kwargs)
class RetrieveUpdateAPIView(mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
SingleObjectAPIView):
"""
Concrete view for retrieving, updating a model instance.
"""
def get(self, request, *args, **kwargs):
return self.retrieve(request, *args, **kwargs)
def put(self, request, *args, **kwargs):
return self.update(request, *args, **kwargs)
class RetrieveDestroyAPIView(mixins.RetrieveModelMixin, class RetrieveDestroyAPIView(mixins.RetrieveModelMixin,
mixins.DestroyModelMixin, mixins.DestroyModelMixin,
SingleObjectAPIView): SingleObjectAPIView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment