Fix issue where pk was was being set to a string.

This commit is contained in:
Nathan Agrin 2012-12-07 15:36:53 -08:00
parent b170973993
commit 06c4b90ec4

View File

@ -105,6 +105,10 @@ class UpdateModelMixin(object):
"""
# pk and/or slug attributes are implicit in the URL.
pk = self.kwargs.get(self.pk_url_kwarg, None)
try:
pk = int(pk)
except ValueError:
pass
if pk:
setattr(obj, 'pk', pk)