use get_prep_value / to_python before serializing changed values

This commit is contained in:
Laura Klünder 2017-06-16 13:08:26 +02:00
parent 410398b21e
commit 1d9564568b
2 changed files with 2 additions and 2 deletions

View file

@ -117,7 +117,7 @@ class ChangeSet(models.Model):
setattr(obj, class_value.cache_name, self.get_created_object(class_value.field.model, pk)) setattr(obj, class_value.cache_name, self.get_created_object(class_value.field.model, pk))
continue continue
setattr(obj, name, value) setattr(obj, name, model._meta.get_field(name).to_python(value))
return self.wrap(obj, author=author) return self.wrap(obj, author=author)
@property @property

View file

@ -198,7 +198,7 @@ class ModelInstanceWrapper(BaseWrapper):
self._changeset.add_update(self, name='title_'+lang, value=new_title, author=author) self._changeset.add_update(self, name='title_'+lang, value=new_title, author=author)
continue continue
self._changeset.add_update(self, name=field.name, value=new_value, author=author) self._changeset.add_update(self, name=field.name, value=field.get_prep_value(new_value), author=author)
def delete(self, author=None): def delete(self, author=None):
if author is None: if author is None: