summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/tests.py7
-rw-r--r--ishtar_common/views_item.py4
2 files changed, 10 insertions, 1 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index c2abab10c..8de8fda6e 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -1457,6 +1457,13 @@ class IshtarBasicTest(TestCase):
town.year = 2050
town.save()
town = models.Town.objects.get(numero_insee="99999")
+ self.assertEqual(town.cached_label, "Sin City - 99")
+
+ models.Town.objects.create(name="Mega City", numero_insee="99999",
+ year=2051)
+ mega_city = models.Town.objects.get(numero_insee="99999", year=2051)
+ town.children.add(mega_city)
+ town = models.Town.objects.get(numero_insee="99999-2050")
self.assertEqual(town.cached_label, "Sin City - 99 (2050)")
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index b53beab90..211cb7897 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -568,7 +568,9 @@ def _manage_hierarchic_fields(dct, and_reqs):
suffix = 'cached_label__iexact'
else:
continue
- val = _clean_type_val(dct.pop(req))
+ val = _clean_type_val(dct.pop(req)).strip('"')
+ if val.startswith('"') and val.endswith('"'):
+ val = val[1:-1]
reqs = Q(**{req: val})
base_req = req[:]
for idx in range(HIERARCHIC_LEVELS):