【问题标题】:Django (1.4) how to use with template tag to assign several variablesDjango(1.4)如何使用with模板标签来分配多个变量
【发布时间】:2015-06-10 15:14:23
【问题描述】:

我正在尝试用 :

分配多个变量
{% with 'Foo' as description 'Blah' as description_2 %}
...
{% endwith %}

有什么方法可以实现吗? (它适用于两个with

【问题讨论】:

    标签: django templates templatetag


    【解决方案1】:

    使用新语法可以分配多个变量:

    {% with description='Foo' description_2='Blah' %}
    ...
    {% endwith %}
    

    https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#with

    【讨论】:

      猜你喜欢
      • 2022-11-25
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 2014-08-09
      • 1970-01-01
      • 2012-07-23
      • 2021-06-02
      相关资源
      最近更新 更多