mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-05 06:19:25 +00:00
Fix: rename and retag documents one file move at a time
document_renamer sent a fake post_save per document to trigger the move, and document_retagger moved a document once for each field it assigned. The renamer calls move_files_for_document directly for each document, so progress reflects real work. The retagger opens a file move scope per document, so each document is moved once after all of its assignments.
This commit is contained in:
1 parent
7d5e7b1625
commit
0770b4fcc2
4 files changed
+172
-54
No files matched your search
@@ -1,5 +1,4 @@
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
from documents.file_moves import move_files_for_document
|
||||
from documents.management.commands.base import PaperlessCommand
|
||||
from documents.models import Document
|
||||
|
||||
@@ -11,5 +10,8 @@ class Command(PaperlessCommand):
|
||||
supports_multiprocessing = False
|
||||
|
||||
def handle(self, *args, **options):
|
||||
for document in self.track(Document.objects.all(), description="Renaming..."):
|
||||
post_save.send(Document, instance=document, created=False)
|
||||
for document in self.track(
|
||||
Document.objects.only("pk"),
|
||||
description="Renaming...",
|
||||
):
|
||||
move_files_for_document(document.pk)
|
||||
Reference in new issue
Block a user