From 7a6382f43de728fa31562b9a842b729c8ce1c169 Mon Sep 17 00:00:00 2001 From: Ibrahim Morghim Date: Sat, 2 Mar 2024 22:39:10 +0300 Subject: [PATCH 1/2] fix: error actor is none --- auditlog/receivers.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/auditlog/receivers.py b/auditlog/receivers.py index 02405d5..0893be0 100644 --- a/auditlog/receivers.py +++ b/auditlog/receivers.py @@ -6,7 +6,7 @@ from auditlog.context import auditlog_disabled from auditlog.diff import model_instance_diff from auditlog.models import LogEntry from auditlog.signals import post_log, pre_log - +from crum import get_current_user def check_disable(signal_handler): """ @@ -126,6 +126,7 @@ def _create_log_entry( action=action, changes=changes, force_log=force_log, + actor=get_current_user() ) except BaseException as e: error = e diff --git a/setup.py b/setup.py index 901ab66..372b24c 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( long_description=long_description, long_description_content_type="text/markdown", python_requires=">=3.8", - install_requires=["Django>=3.2", "python-dateutil>=2.7.0"], + install_requires=["Django>=3.2", "python-dateutil>=2.7.0", 'django-crum'], zip_safe=False, classifiers=[ "Programming Language :: Python :: 3", From 48c41139617676896eb976e2d3d7878188b10f1c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 19:39:51 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- auditlog/receivers.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/auditlog/receivers.py b/auditlog/receivers.py index 0893be0..75da82f 100644 --- a/auditlog/receivers.py +++ b/auditlog/receivers.py @@ -1,12 +1,13 @@ from functools import wraps +from crum import get_current_user from django.conf import settings from auditlog.context import auditlog_disabled from auditlog.diff import model_instance_diff from auditlog.models import LogEntry from auditlog.signals import post_log, pre_log -from crum import get_current_user + def check_disable(signal_handler): """ @@ -126,7 +127,7 @@ def _create_log_entry( action=action, changes=changes, force_log=force_log, - actor=get_current_user() + actor=get_current_user(), ) except BaseException as e: error = e diff --git a/setup.py b/setup.py index 372b24c..93f71e1 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ setup( long_description=long_description, long_description_content_type="text/markdown", python_requires=">=3.8", - install_requires=["Django>=3.2", "python-dateutil>=2.7.0", 'django-crum'], + install_requires=["Django>=3.2", "python-dateutil>=2.7.0", "django-crum"], zip_safe=False, classifiers=[ "Programming Language :: Python :: 3",