【问题标题】:Template for loop if the current iteration is different from the previous iteration如果当前迭代与前一个迭代不同,则为循环模板
【发布时间】:2013-08-29 19:37:42
【问题描述】:

我想拥有

{% for user_id, x, y in information %}
    {% if it is the first time that user_id is different from the previous iteration %}
        do something
    {% elseif user_id is different from the user_id in the previous iteration %}
        do something
    {% endif %}

谁能帮忙。谢谢!!!

【问题讨论】:

    标签: html django templates


    【解决方案1】:

    您正在寻找{% ifchanged %}。看看这里:https://docs.djangoproject.com/en/dev/ref/templates/builtins/#ifchanged

    【讨论】:

    • user_id第一次变化是怎么回事
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-11
    • 2012-06-12
    • 2019-11-29
    • 2016-12-11
    • 2020-04-26
    • 2015-05-04
    • 2015-06-28
    相关资源
    最近更新 更多