feat: pass data_filter/filter_labels to Tabular widget; fix json.loads for data_filter string
This commit is contained in:
parent
41f5b65f1f
commit
057ca605c1
@ -69,6 +69,18 @@ data_browser_tmpl = """
|
|||||||
{% if content_view %}
|
{% if content_view %}
|
||||||
"content_view":{{json.dumps(content_view, indent=4, ensure_ascii=False)}},
|
"content_view":{{json.dumps(content_view, indent=4, ensure_ascii=False)}},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if data_filter %}
|
||||||
|
"data_filter":{{json.dumps(data_filter, indent=4, ensure_ascii=False)}},
|
||||||
|
{% endif %}
|
||||||
|
{% if filter_labels %}
|
||||||
|
"filter_labels":{{json.dumps(filter_labels, indent=4, ensure_ascii=False)}},
|
||||||
|
{% endif %}
|
||||||
|
{% if filter_title %}
|
||||||
|
"filter_title":"{{filter_title}}",
|
||||||
|
{% endif %}
|
||||||
|
{% if filter_icon %}
|
||||||
|
"filter_icon":"{{filter_icon}}",
|
||||||
|
{% endif %}
|
||||||
{% if subtables_condition %}
|
{% if subtables_condition %}
|
||||||
{%- raw -%}{% endif %}{%- endraw %}
|
{%- raw -%}{% endif %}{%- endraw %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -133,6 +145,11 @@ ns['sort'] = '{{relation.outter_field}}_text'
|
|||||||
sql = '''{{sql}}'''
|
sql = '''{{sql}}'''
|
||||||
{% if not relation %}
|
{% if not relation %}
|
||||||
filterjson = params_kw.get('data_filter')
|
filterjson = params_kw.get('data_filter')
|
||||||
|
if filterjson and isinstance(filterjson, str):
|
||||||
|
\ttry:
|
||||||
|
\t\tfilterjson = json.loads(filterjson)
|
||||||
|
\texcept (json.JSONDecodeError, TypeError):
|
||||||
|
\t\tfilterjson = None
|
||||||
fields_str=r'''{{json.dumps(fields, indent=4, ensure_ascii=False)}}'''
|
fields_str=r'''{{json.dumps(fields, indent=4, ensure_ascii=False)}}'''
|
||||||
ori_fields = json.loads(fields_str)
|
ori_fields = json.loads(fields_str)
|
||||||
if not filterjson:
|
if not filterjson:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user