Merge pull request #593 from BastianPoe/feature-293

Give stored documents a structured and configurable filename
This commit is contained in:
JOKer
2020-05-02 08:33:49 +02:00
committed by GitHub
7 changed files with 878 additions and 5 deletions

View File

@@ -0,0 +1,24 @@
from django.core.management.base import BaseCommand
from documents.models import Document, Tag
from ...mixins import Renderable
class Command(Renderable, BaseCommand):
help = """
This will rename all documents to match the latest filename format.
""".replace(" ", "")
def __init__(self, *args, **kwargs):
self.verbosity = 0
BaseCommand.__init__(self, *args, **kwargs)
def handle(self, *args, **options):
self.verbosity = options["verbosity"]
for document in Document.objects.all():
# Saving the document again will generate a new filename and rename
document.save()