mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-04 22:09:24 +00:00
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.
18 lines
516 B
Python
18 lines
516 B
Python
from documents.file_moves import move_files_for_document
|
|
from documents.management.commands.base import PaperlessCommand
|
|
from documents.models import Document
|
|
|
|
|
|
class Command(PaperlessCommand):
|
|
help = "Rename all documents"
|
|
|
|
supports_progress_bar = True
|
|
supports_multiprocessing = False
|
|
|
|
def handle(self, *args, **options):
|
|
for document in self.track(
|
|
Document.objects.only("pk"),
|
|
description="Renaming...",
|
|
):
|
|
move_files_for_document(document.pk)
|