mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
added RetrieveUpdateAPIView
This commit is contained in:
parent
497da7fc69
commit
e198a2b376
|
@ -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 @@
|
||||||
>
|
>
|
||||||
> — 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,
|
||||||
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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user