Django 模板标记如果
我得到两个变量:Django 模板标记如果,django,Django,我得到两个变量: post = Post.objects.get(pk=post_id) rated = Rated.objects.filter(username=request.user,rated=True) 由django mptt magicpost.comment\u root.get\u substands转换为节点 在模板中,我尝试使用: {% if node in rated %} X {% else %} Y {% endif %} ,但总是会感到不安。为
post = Post.objects.get(pk=post_id)
rated = Rated.objects.filter(username=request.user,rated=True)
由django mptt magicpost.comment\u root.get\u substands
转换为节点
在模板中,我尝试使用:
{% if node in rated %}
X
{% else %}
Y
{% endif %}
,但总是会感到不安。为什么
附言:对不起我的英语我猜是
post.comment\u root.get\u subjections
为你提供了一个comment
S的查询集。注释
永远不会出现在分级
的查询集中,因为它们是不同类型的。您需要将苹果与苹果进行比较。发布“额定”和“节点”的示例值