fix: trade_policy 宏使用 with context 修复 500
Jinja imported macros did not receive trade_policy from render context, causing Internal Server Error on all instance pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
{# 方向 / 币种:env 账户级限制(三所共用宏) #}
|
||||
{# 方向 / 币种:env 账户级限制(三所共用宏);调用方须 with context #}
|
||||
{% if trade_policy is not defined %}
|
||||
{% set trade_policy = {'symbol_restrict_enabled': false, 'direction_restrict_enabled': false, 'symbol_whitelist': [], 'allows_long': true, 'allows_short': true, 'direction_mode': 'both', 'badge_text': ''} %}
|
||||
{% endif %}
|
||||
{% macro trade_policy_symbol(name, id, value='', required=true, placeholder='BTC 或 BTC/USDT') -%}
|
||||
{% if trade_policy.symbol_restrict_enabled and trade_policy.symbol_whitelist %}
|
||||
<select name="{{ name }}" id="{{ id }}" {% if required %}required{% endif %} class="trade-policy-symbol-select">
|
||||
|
||||
Reference in New Issue
Block a user