From 98b200c630474559eb13e48c173473bab7b3735b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 18 Oct 2021 12:11:10 +0200 Subject: ID generation: fix custom filters for jinja format --- archaeological_finds/tests.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'archaeological_finds') 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() -- cgit v1.2.3