How to split long line in Django template?

后端 未结 2 1656
太阳男子
太阳男子 2021-02-12 11:50

I have a line in my Django template that is too long:

 {% for some_item, some_another_item, again_some_another_item_with_long_name in items %}

Is

2条回答
  •  不知归路
    2021-02-12 12:32

    If you really want to keep those nasty long names, what I would do is:

    {% for a, b, c in items %}
        {% with a as some_item %}
        {% with b as some_another_item %}
        {% with c as again_some_another_item_with_long_name %}
            bla bla bla ..
        {% endwith %}
        {% endwith %}
        {% endwith %}
    {% endfor %}
    

提交回复
热议问题