Revised the save() method so that it works both with the current user from the its parameter or from the parameter from the constructor.
This commit is contained in:
parent
bbd3d0e470
commit
88e3637663
@ -71,7 +71,9 @@ class Account(DirtyFieldsMixin, models.Model):
|
||||
else Account.objects.get(code=self.code[:-1])
|
||||
if self.pk is None:
|
||||
self.pk = new_pk(Account)
|
||||
if getattr(self, "created_by", None) is None:
|
||||
self.created_by = current_user
|
||||
if getattr(self, "updated_by", None) is None:
|
||||
self.updated_by = current_user
|
||||
with transaction.atomic():
|
||||
super(Account, self).save(
|
||||
|
Loading…
Reference in New Issue
Block a user