diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-04-22 15:16:08 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-04-23 10:48:32 +0200 |
commit | f804dfc0a48130eefe7048938c20d7d19a69caaf (patch) | |
tree | 84206796b1048bd9e46ab353f272c4c5e703266b /ishtar_common/models_common.py | |
parent | aded77feef3381632281dcc005160e2cb0c6b4dc (diff) | |
download | Ishtar-f804dfc0a48130eefe7048938c20d7d19a69caaf.tar.bz2 Ishtar-f804dfc0a48130eefe7048938c20d7d19a69caaf.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.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 91a3619ce..d932abf66 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 @@ -895,11 +896,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) |