diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.py index b02fd686b..081dfb360 100644 --- a/src/documents/management/commands/document_exporter.py +++ b/src/documents/management/commands/document_exporter.py @@ -9,9 +9,6 @@ from typing import Optional import tqdm from django.conf import settings - -if settings.AUDIT_LOG_ENABLED: - from auditlog.models import LogEntry from django.contrib.auth.models import Group from django.contrib.auth.models import Permission from django.contrib.auth.models import User @@ -25,6 +22,9 @@ from filelock import FileLock from guardian.models import GroupObjectPermission from guardian.models import UserObjectPermission +if settings.AUDIT_LOG_ENABLED: + from auditlog.models import LogEntry + from documents.file_handling import delete_empty_directories from documents.file_handling import generate_filename from documents.models import Correspondent diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index 213e3cc27..ebe857948 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -5,7 +5,6 @@ import zoneinfo from decimal import Decimal import magic -from auditlog.context import set_actor from celery import states from django.conf import settings from django.contrib.auth.models import Group @@ -28,6 +27,9 @@ from rest_framework import fields from rest_framework import serializers from rest_framework.fields import SerializerMethodField +if settings.AUDIT_LOG_ENABLED: + from auditlog.context import set_actor + from documents import bulk_edit from documents.data_models import DocumentSource from documents.models import Correspondent