无法解析余数 [英] Could not parse the remainder

查看:16
本文介绍了无法解析余数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想比较 num 和 {{buildSummary_list.number}},但为什么它不起作用?我有一个错误

i want to compare num and {{buildSummary_list.number}}, but why it is not work? And i got an error

Could not parse the remainder: '{{buildSummary_list.number}}' from '{{buildSummary_list.number}}'"...

<小时>

{% for num in buildSummary_list.paginator.page_range %}
    {% ifequal num {{buildSummary_list.number}} %}
        <b>{{num}}</b>
    {% endifequal %}
    {% ifnotequal num {{buildSummary_list.number}} %}
        <a href="?page={{num}}"><b>{{num}}</b></a>
    {% endifnotequal %}

{% endfor %}

我想让分页生效:预<<1 2 3 4 5 6 >> 下一个

I want to make the pagination have effect: pre << 1 2 3 4 5 6 >> next

我的代码可以运行,能做出这个效果吗?谢谢:D

I my code can run, can it make this effect? thanks:D

推荐答案

{% %} 标签内,变量没有被 {{ 包围.试试这个:

Inside a {% %} tag, variables aren't surrounded by {{. Try this:

{% ifequal num buildSummary_list.number %}

另外,看起来你的两个比较可以用 else 连接:

Also, it looks like your two comparisons can be joined with an else:

{% for num in buildSummary_list.paginator.page_range %}
    {% ifequal num buildSummary_list.number %}
        <b>{{num}}</b>
    {% else %}
        <a href="?page={{num}}"><b>{{num}}</b></a>
    {% endifequal %}
{% endfor %}

这篇关于无法解析余数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆