From 9a04bc1bebfb0ba423ec83eb40e0c52108edd7d3 Mon Sep 17 00:00:00 2001 From: jonaswinkler <17569239+jonaswinkler@users.noreply.github.com> Date: Wed, 17 Mar 2021 22:57:37 +0100 Subject: [PATCH] fixes #771 --- .../management/commands/document_exporter.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.py index d8f5861a5..286d862e3 100644 --- a/src/documents/management/commands/document_exporter.py +++ b/src/documents/management/commands/document_exporter.py @@ -6,15 +6,18 @@ import time import tqdm from django.conf import settings +from django.contrib.auth.models import User from django.core import serializers from django.core.management.base import BaseCommand, CommandError from django.db import transaction from filelock import FileLock -from documents.models import Document, Correspondent, Tag, DocumentType +from documents.models import Document, Correspondent, Tag, DocumentType, \ + SavedView, SavedViewFilterRule from documents.settings import EXPORTER_FILE_NAME, EXPORTER_THUMBNAIL_NAME, \ EXPORTER_ARCHIVE_NAME from paperless.db import GnuPG +from paperless_mail.models import MailAccount, MailRule from ...file_handling import generate_filename, delete_empty_directories @@ -105,6 +108,21 @@ class Command(BaseCommand): serializers.serialize("json", documents)) manifest += document_manifest + manifest += json.loads(serializers.serialize( + "json", MailAccount.objects.all())) + + manifest += json.loads(serializers.serialize( + "json", MailRule.objects.all())) + + manifest += json.loads(serializers.serialize( + "json", SavedView.objects.all())) + + manifest += json.loads(serializers.serialize( + "json", SavedViewFilterRule.objects.all())) + + manifest += json.loads(serializers.serialize( + "json", User.objects.all())) + # 3. Export files from each document for index, document_dict in tqdm.tqdm(enumerate(document_manifest), total=len(document_manifest)):