This commit is contained in:
jonaswinkler 2021-03-17 22:57:37 +01:00
parent b39c3f7866
commit 9a04bc1beb

View File

@ -6,15 +6,18 @@ import time
import tqdm import tqdm
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User
from django.core import serializers from django.core import serializers
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.db import transaction from django.db import transaction
from filelock import FileLock 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, \ from documents.settings import EXPORTER_FILE_NAME, EXPORTER_THUMBNAIL_NAME, \
EXPORTER_ARCHIVE_NAME EXPORTER_ARCHIVE_NAME
from paperless.db import GnuPG from paperless.db import GnuPG
from paperless_mail.models import MailAccount, MailRule
from ...file_handling import generate_filename, delete_empty_directories from ...file_handling import generate_filename, delete_empty_directories
@ -105,6 +108,21 @@ class Command(BaseCommand):
serializers.serialize("json", documents)) serializers.serialize("json", documents))
manifest += document_manifest 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 # 3. Export files from each document
for index, document_dict in tqdm.tqdm(enumerate(document_manifest), for index, document_dict in tqdm.tqdm(enumerate(document_manifest),
total=len(document_manifest)): total=len(document_manifest)):