Feature: Enhanced templating for filename format (#7836)

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Trenton H 2024-10-06 12:54:01 -07:00 committed by GitHub
parent e49ed58f1a
commit 7c11a37150
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1299 additions and 615 deletions

View file

@ -2,10 +2,12 @@ import textwrap
from unittest import mock
from django.core.checks import Error
from django.core.checks import Warning
from django.test import TestCase
from django.test import override_settings
from documents.checks import changed_password_check
from documents.checks import filename_format_check
from documents.checks import parser_check
from documents.models import Document
from documents.tests.factories import DocumentFactory
@ -73,3 +75,17 @@ class TestDocumentChecks(TestCase):
),
],
)
def test_filename_format_check(self):
self.assertEqual(filename_format_check(None), [])
with override_settings(FILENAME_FORMAT="{created}/{title}"):
self.assertEqual(
filename_format_check(None),
[
Warning(
"Filename format {created}/{title} is using the old style, please update to use double curly brackets",
hint="{{ created }}/{{ title }}",
),
],
)