From 96d3906c81f33e70e4b2a914ee9d84ddcf803e5b Mon Sep 17 00:00:00 2001 From: GreatBahram Date: Mon, 10 Jun 2024 15:12:21 +0200 Subject: [PATCH] Reorder condition in get_field_value function: as many people have non-database fields and this will break their code ;) --- auditlog/diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auditlog/diff.py b/auditlog/diff.py index 2fd44a9..722ae97 100644 --- a/auditlog/diff.py +++ b/auditlog/diff.py @@ -83,7 +83,7 @@ def get_field_value(obj, field): value = json.dumps(value, sort_keys=True, cls=field.encoder) except TypeError: pass - elif (field.one_to_one or field.many_to_one) and hasattr(field, "rel_class"): + elif hasattr(field, "rel_class") and (field.one_to_one or field.many_to_one): value = smart_str( getattr(obj, field.get_attname(), None), strings_only=True )