jec*_*918 2 html python django
基本上我希望这是一个简单的问题,我只想检查查询集是否包含多个对象,但我不知道该怎么做?我写的(不起作用)如下。
{% if game.developer.all > 1 %}
<h1>Developers:</h1>
{% else %}
<h1>Developer:</h1>
{% endif %}
Run Code Online (Sandbox Code Playgroud)
用于count()检查 QuerySet 中的对象总数:
{% if game.developer.all.count > 1 %}
<h1>Developers:</h1>
{% else %}
<h1>Developer:</h1>
{% endif %}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
944 次 |
| 最近记录: |