Skip to content

Commit

Permalink
fix: previous_values_are_unequal
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jun 20, 2024
1 parent d028ccd commit 8e7e28d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions codeforlife/models/signals/pre_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ def previous_values_are_unequal(instance: _.AnyModel, fields: t.Set[str]):
"""
# pylint: enable=line-too-long

def predicate(v1, v2):
return v1 != v2

return check_previous_values(
instance, {field: predicate for field in fields}
instance,
{
field: lambda previous_value: (
previous_value != getattr(instance, field)
)
for field in fields
},
)

0 comments on commit 8e7e28d

Please sign in to comment.