mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Removing Partial Update classes
PATCH methods merged into RetrieveUpdateDestroy class
This commit is contained in:
parent
e61eab43f4
commit
b9e48e8413
|
@ -171,13 +171,6 @@ class UpdateAPIView(mixins.UpdateModelMixin,
|
||||||
def put(self, request, *args, **kwargs):
|
def put(self, request, *args, **kwargs):
|
||||||
return self.update(request, partial=False, *args, **kwargs)
|
return self.update(request, partial=False, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class ParitalUpdateAPIView(mixins.UpdateModelMixin,
|
|
||||||
SingleObjectAPIView):
|
|
||||||
|
|
||||||
"""
|
|
||||||
Concrete view for paritally updating a model instance.
|
|
||||||
"""
|
|
||||||
def patch(self, request, *args, **kwargs):
|
def patch(self, request, *args, **kwargs):
|
||||||
return self.update(request, partial=True, *args, **kwargs)
|
return self.update(request, partial=True, *args, **kwargs)
|
||||||
|
|
||||||
|
@ -224,24 +217,5 @@ class RetrieveUpdateDestroyAPIView(mixins.RetrieveModelMixin,
|
||||||
def delete(self, request, *args, **kwargs):
|
def delete(self, request, *args, **kwargs):
|
||||||
return self.destroy(request, *args, **kwargs)
|
return self.destroy(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class RetrievePartialUpdateDestroyAPIView(mixins.RetrieveModelMixin,
|
|
||||||
mixins.UpdateModelMixin,
|
|
||||||
mixins.DestroyModelMixin,
|
|
||||||
SingleObjectAPIView):
|
|
||||||
|
|
||||||
"""
|
|
||||||
Concrete view for retrieving, updating via PATCH (partial) or PUT (full),
|
|
||||||
or deleting 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, partial=False, *args, **kwargs)
|
|
||||||
|
|
||||||
def patch(self, request, *args, **kwargs):
|
def patch(self, request, *args, **kwargs):
|
||||||
return self.update(request, partial=True, *args, **kwargs)
|
return self.update(request, partial=True, *args, **kwargs)
|
||||||
|
|
||||||
def delete(self, request, *args, **kwargs):
|
|
||||||
return self.destroy(request, *args, **kwargs)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user