如何在Django模板标签内执行split()函数?

问题描述 投票:0回答:1

我需要在Django模板标签内执行split()函数。我试图这样做,但是不起作用

{% for m in us.member %}
    {% with mv=((m.split(','))[0].split('='))[1] %}
           <h3 class="media-title">
                {{ mv }}
           </h3>
    {% endwith %}
{% endfor %}

m的值返回字符串值

'cn = RND3,ou = Production_test,dc = iss,dc = rndtest,dc = local'

预期输出为RND3

python django django-forms django-templates django-views
1个回答
0
投票

无法在以下模板中运行原始的python代码django。

© www.soinside.com 2019 - 2024. All rights reserved.