From 6da9cd5429b9f480a65d27b93c2938b927f72a5b Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 2 Jan 2013 17:43:43 +0000 Subject: [PATCH] Add `.patch()` method for `RetrieveUpdateAPIView` --- rest_framework/generics.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rest_framework/generics.py b/rest_framework/generics.py index cda9ca79c..19f2b7047 100644 --- a/rest_framework/generics.py +++ b/rest_framework/generics.py @@ -203,6 +203,10 @@ class RetrieveUpdateAPIView(mixins.RetrieveModelMixin, def put(self, request, *args, **kwargs): return self.update(request, *args, **kwargs) + def patch(self, request, *args, **kwargs): + kwargs['partial'] = True + return self.update(request, *args, **kwargs) + class RetrieveDestroyAPIView(mixins.RetrieveModelMixin, mixins.DestroyModelMixin, @@ -230,9 +234,9 @@ class RetrieveUpdateDestroyAPIView(mixins.RetrieveModelMixin, def put(self, request, *args, **kwargs): return self.update(request, *args, **kwargs) - def delete(self, request, *args, **kwargs): - return self.destroy(request, *args, **kwargs) - def patch(self, request, *args, **kwargs): kwargs['partial'] = True return self.update(request, *args, **kwargs) + + def delete(self, request, *args, **kwargs): + return self.destroy(request, *args, **kwargs)