summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_finds/tests.py8
-rw-r--r--ishtar_common/views_item.py2
2 files changed, 6 insertions, 4 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index d5f1fdb62..806696d4c 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -657,7 +657,7 @@ class FindSearchTest(FindInit, TestCase):
self.password)
self.client = Client()
- def testMaterialTypeHierarchicSearch(self):
+ def test_material_type_hierarchic_search(self):
find = self.finds[0]
c = Client()
metal = models.MaterialType.objects.get(txt_idx='metal')
@@ -665,6 +665,8 @@ class FindSearchTest(FindInit, TestCase):
not_iron_metal = models.MaterialType.objects.get(
txt_idx='not_iron_metal')
find.material_types.add(iron_metal)
+ find = models.Find.objects.get(pk=find.pk)
+ find.save()
search = {'material_types': iron_metal.pk}
@@ -680,7 +682,7 @@ class FindSearchTest(FindInit, TestCase):
content = response.content.decode()
res = json.loads(content)
self.assertEqual(res['recordsTotal'], 1)
- self.assertEqual(res["rows"][0]["material_types"],
+ self.assertEqual(res["rows"][0]["cached_materials"],
str(iron_metal))
# no result for the brother
@@ -731,6 +733,8 @@ class FindSearchTest(FindInit, TestCase):
period=final_neo
)
find.datings.add(dating)
+ find = models.Find.objects.get(pk=find.pk)
+ find.save()
search = {'datings__period': final_neo.pk}
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index c508fa35d..032d3e2c2 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -1864,8 +1864,6 @@ def get_item(model, func_name, default_name, extra_request_keys=None,
if isinstance(value, datetime.datetime):
value = value.strftime('%Y-%m-%d %H:%M:%S')
res[k] = value
- else:
- res[k] = ""
if full == 'shortcut':
if 'cached_label' in res:
res['value'] = res.pop('cached_label')