From 8e7e28dab33381f5e580757c8706c15caadc58e5 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Thu, 20 Jun 2024 11:44:16 +0000 Subject: [PATCH] fix: previous_values_are_unequal --- codeforlife/models/signals/pre_save.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/codeforlife/models/signals/pre_save.py b/codeforlife/models/signals/pre_save.py index faeb4125..9eccc283 100644 --- a/codeforlife/models/signals/pre_save.py +++ b/codeforlife/models/signals/pre_save.py @@ -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 + }, )