Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OFS-99: django-dirty-fields bug - applied additional param in 'is_dirty' #27

Merged
merged 1 commit into from Dec 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/models.py
Expand Up @@ -591,7 +591,7 @@ def save(self, *args, **kwargs):
self.date_created = now
self.date_updated = now
return super(HistoryModel, self).save()
if self.is_dirty():
if self.is_dirty(check_relationship=True):
self.date_updated = now
self.user_updated = user
self.version = self.version + 1
Expand All @@ -604,7 +604,7 @@ def delete_history(self):

def delete(self, *args, **kwargs):
user = User.objects.get(**kwargs)
if not self.is_dirty() and not self.is_deleted:
if not self.is_dirty(check_relationship=True) and not self.is_deleted:
self.date_updated = py_datetime.now()
self.user_updated = user
self.version = self.version + 1
Expand Down Expand Up @@ -654,7 +654,7 @@ def _create_new_entity(self, user):

def _update_replaced_entity(self, user, uuid_from_new_entity, date_valid_from_new_entity):
"""2 step - update the fields for the entity to be replaced"""
if not self.is_dirty():
if not self.is_dirty(check_relationship=True):
if self.date_valid_to is not None:
if date_valid_from_new_entity < self.date_valid_to:
self.date_valid_to = date_valid_from_new_entity
Expand Down