diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-18 12:11:10 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-10-18 12:11:10 +0200 |
commit | 98b200c630474559eb13e48c173473bab7b3735b (patch) | |
tree | f75751af60131cc704270c0b4dc3c52e8957f6a4 /archaeological_finds/tests.py | |
parent | c56e12387267e4cabb3b3e364bd60222134148c7 (diff) | |
download | Ishtar-98b200c630474559eb13e48c173473bab7b3735b.tar.bz2 Ishtar-98b200c630474559eb13e48c173473bab7b3735b.zip |
ID generation: fix custom filters for jinja format
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index d0adc766a..c2979d074 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -958,6 +958,24 @@ class FindTest(FindInit, TestCase): find.save() find = models.Find.objects.get(pk=find.pk) self.assertEqual(find.external_id, "pat-12345-a1-new-label-too-hop") + # jinja 2 + profile.find_external_id = ( + "{{get_first_base_find__context_record__external_id}}-{{label}}-" + "{{label}}" + ) + profile.save() + find.save() + find = models.Find.objects.get(pk=find.pk) + self.assertEqual(find.external_id, "PAT-12345-A1-new-label-too-hop-hop") + # jinja 2 + custom filters + profile.find_external_id = ( + "{{get_first_base_find__context_record__external_id}}-{{label}}-" + "{{label}}||lower||deduplicate" + ) + profile.save() + find.save() + find = models.Find.objects.get(pk=find.pk) + self.assertEqual(find.external_id, "pat-12345-a1-new-label-too-hop") def testIndex(self): profile = get_current_profile() |