diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-05-28 12:13:54 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:28 +0200 |
commit | 779db09e8589e2ce58c0d1b7c34877f4ff0f9988 (patch) | |
tree | 5ee5e1a3b19fd7a556d68bc8c9cd1403d55e41c6 | |
parent | 764da8cb517be0224db8da4f881f569997146512 (diff) | |
download | Ishtar-779db09e8589e2ce58c0d1b7c34877f4ff0f9988.tar.bz2 Ishtar-779db09e8589e2ce58c0d1b7c34877f4ff0f9988.zip |
Search results do change None to "" - Fix find tests
-rw-r--r-- | archaeological_finds/tests.py | 8 | ||||
-rw-r--r-- | ishtar_common/views_item.py | 2 |
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') |