summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-04-22 15:16:08 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-04-23 11:19:15 +0200
commitf6607acad89198b7b33df4c99041af84c9fe9d69 (patch)
treef27677df294f46df387ec452cc12e751d33c8ce7 /ishtar_common/models_common.py
parent2c539d0c805f59fea30546740e9fafbae94d132a (diff)
downloadIshtar-f6607acad89198b7b33df4c99041af84c9fe9d69.tar.bz2
Ishtar-f6607acad89198b7b33df4c99041af84c9fe9d69.zip
🐛 fix table export with json fields in search (refs #6292)
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 96eb26bbf..334eb8b75 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -9,6 +9,7 @@ import copy
from collections import OrderedDict
import datetime
import fiona
+from importlib import import_module
import json
import logging
import os
@@ -957,11 +958,22 @@ class FullSearch(models.Model):
PARENT_SEARCH_VECTORS = []
# prevent circular dependency
PARENT_ONLY_SEARCH_VECTORS = []
+ # tuple (module, class) in text for dynamic import
+ DEFAULT_SEARCH_FORM = tuple()
class Meta:
abstract = True
@classmethod
+ def get_default_search_form(cls):
+ # DEFAULT_SEARCH_FORM is used to get the form when exporting tables
+ if not cls.DEFAULT_SEARCH_FORM:
+ return
+ form = getattr(import_module(cls.DEFAULT_SEARCH_FORM[0]),
+ cls.DEFAULT_SEARCH_FORM[1])
+ return form
+
+ @classmethod
def general_types(cls):
for k in get_all_field_names(cls):
field = cls._meta.get_field(k)