'int'对象不可编辑我在我的模板上得到了这个错误,我明白,我想这是什么意思-条件:{% elif User_No_Auth_Tld > 0 %}
不能允许for()
循环遍历结果({% for NotAuthDomain in User_No_Auth_Tld %}
),但我尝试了:{% elif User_No_Auth_Tld %}
(没有整数条件),但仍然得到相同的错误。在
我到底做错了什么?在
谢谢你
{% if not User_Tld_Entered %} <!-- show ADD TLD form -->
<hr />
#form here
<br />
<h4>Verify your domain</h4>
{% elif User_No_Auth_Tld > 0 %}
<h1>display unauth domains, with auth link</h1>
{% for NotAuthDomain in User_No_Auth_Tld %}
{{ NotAuthDomain }}
{% endfor %}
{% elif User_Auth_Tld %}
#form here.
{% endif %}
对于将来可能会浏览此帖子寻求帮助的用户:
最后,我更改了User_No_Auth_Tld
的声明,使其不对db记录使用.count()
方法。在
这不是关于条件,而是关于iterable本身。
确保
User_No_Auth_Tld
不是int
,而是list
,dict
或任何其他iterable。在相关问题 更多 >
编程相关推荐