From deec657d7e350737e11f1d93860d08430f14753d Mon Sep 17 00:00:00 2001 From: Caitlin Barnard Date: Fri, 6 Dec 2024 14:42:52 +0000 Subject: [PATCH] Create logEntry object if none exists --- core/utils/generic_helpers.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/core/utils/generic_helpers.py b/core/utils/generic_helpers.py index 0c4076d4..d548b1eb 100644 --- a/core/utils/generic_helpers.py +++ b/core/utils/generic_helpers.py @@ -86,14 +86,6 @@ def check_empty(value): return None -class EmptyLogObject: - def __init__(self, app_label="generic", model_name="empty", pk=None): - self.pk = str(pk) - self._meta = type( - "meta", (), {"app_label": app_label, "model_name": model_name} - ) - - def log_object_change( requesting_user_id, message, @@ -107,9 +99,11 @@ def log_object_change( queryset=[obj], ) else: - LogEntry.objects.log_actions( + LogEntry.objects.create( user_id=requesting_user_id, + content_type_id=None, + object_id=None, + object_repr="", action_flag=CHANGE, change_message=message, - queryset=[EmptyLogObject()], )