Moves the renaming ttask into the serialiser update instead of post_save. Feels more correct

This commit is contained in:
Trenton H
2023-02-17 17:43:56 -08:00
parent aea79a1e9a
commit facec31bad
4 changed files with 46 additions and 104 deletions

View File

@@ -21,14 +21,12 @@ from django.utils import timezone
from filelock import FileLock
from .. import matching
from ..bulk_edit import bulk_update_documents
from ..file_handling import create_source_path_directory
from ..file_handling import delete_empty_directories
from ..file_handling import generate_unique_filename
from ..models import Document
from ..models import MatchingModel
from ..models import PaperlessTask
from ..models import StoragePath
from ..models import Tag
logger = logging.getLogger("paperless.handlers")
@@ -497,17 +495,6 @@ def update_filename_and_move_files(sender, instance: Document, **kwargs):
)
@receiver(models.signals.post_save, sender=StoragePath)
def update_document_storage_path(sender, instance: StoragePath, **kwargs):
"""
Triggers when a storage path is changed, running against any documents using
the path, and checks to see if they need to be renamed
"""
doc_ids = [doc.id for doc in instance.documents.all()]
if len(doc_ids):
bulk_update_documents.delay(doc_ids)
def set_log_entry(sender, document=None, logging_group=None, **kwargs):
ct = ContentType.objects.get(model="document")