use author of ModelInstanceWrapper if not missing in save or delete call

This commit is contained in:
Laura Klünder 2017-06-13 03:39:52 +02:00
parent b062e76b7a
commit 4e1469c7d4

View file

@ -110,6 +110,8 @@ class ModelInstanceWrapper(BaseWrapper):
raise TypeError
def save(self, author=None):
if author is None:
author = self._author
if self.pk is None:
self._changeset.add_create(self, author=author)
for field, initial_value in self._initial_values.items():
@ -132,6 +134,8 @@ class ModelInstanceWrapper(BaseWrapper):
self._changeset.add_update(self, name=field.name, value=new_value, author=author)
def delete(self, author=None):
if author is None:
author = self._author
self._changeset.add_delete(self, author=author)