aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/mixins.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/mixins.py')
-rw-r--r--rest_framework/mixins.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py
index 87d97bed..503376ce 100644
--- a/rest_framework/mixins.py
+++ b/rest_framework/mixins.py
@@ -115,6 +115,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):
"""
@@ -122,6 +126,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)