Further testing and examples
This commit is contained in:
@@ -1289,3 +1289,22 @@ class TestFilenameGeneration(DirectoriesMixin, TestCase):
|
||||
generate_filename(doc_a),
|
||||
"not-invoices/Some Title.pdf",
|
||||
)
|
||||
|
||||
def test_using_other_filters(self):
|
||||
doc_a = Document.objects.create(
|
||||
title="Some Title",
|
||||
created=timezone.make_aware(datetime.datetime(2020, 6, 25, 7, 36, 51, 153)),
|
||||
added=timezone.make_aware(datetime.datetime(2024, 10, 1, 7, 36, 51, 153)),
|
||||
mime_type="application/pdf",
|
||||
pk=2,
|
||||
checksum="2",
|
||||
archive_serial_number=25,
|
||||
)
|
||||
|
||||
with override_settings(
|
||||
FILENAME_FORMAT="{% if document.correspondent %}{{ document.correspondent.name }}{% else %}No Correspondent{% endif %}/{title}",
|
||||
):
|
||||
self.assertEqual(
|
||||
generate_filename(doc_a),
|
||||
"No Correspondent/Some Title.pdf",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user