diff options
Diffstat (limited to 'rest_framework/mixins.py')
| -rw-r--r-- | rest_framework/mixins.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py index b71ab05c..d828078d 100644 --- a/rest_framework/mixins.py +++ b/rest_framework/mixins.py @@ -113,6 +113,10 @@ class UpdateModelMixin(object): slug_field = self.get_slug_field() setattr(obj, slug_field, slug) + # Ensure we clean the attributes so that we don't eg return integer + # pk using a string representation, as provided by the url conf kwarg. + obj.full_clean() + class DestroyModelMixin(object): """ @@ -120,6 +124,6 @@ class DestroyModelMixin(object): Should be mixed in with `SingleObjectBaseView`. """ def destroy(self, request, *args, **kwargs): - self.object = self.get_object() - self.object.delete() + obj = self.get_object() + obj.delete() return Response(status=status.HTTP_204_NO_CONTENT) |
