aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/mixins.py
diff options
context:
space:
mode:
authorTom Christie2012-12-18 18:21:58 +0000
committerTom Christie2012-12-18 18:21:58 +0000
commit6693d2d277823c9150077c7c9534b7550dfd192c (patch)
treee7f547a95cc152a8a809ab39595c3008d2e16c1e /rest_framework/mixins.py
parent8f23b7f2f901751ecb79e98a540d3a8dc83b0d1a (diff)
downloaddjango-rest-framework-6693d2d277823c9150077c7c9534b7550dfd192c.tar.bz2
Fix for pks returning as strings when set in pre_save. Fixes #482. Thanks to @n8agrin for the bug report.
Diffstat (limited to 'rest_framework/mixins.py')
-rw-r--r--rest_framework/mixins.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py
index 1edcfa5c..8dc0c329 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):
"""