如何检查 Django Queryset 是否返回多个对象?

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)

Dir*_*Bit 6

用于count()检查 QuerySet 中的对象总数:

{% if game.developer.all.count > 1 %} 
   <h1>Developers:</h1>
{% else %} 
   <h1>Developer:</h1>
{% endif %}
Run Code Online (Sandbox Code Playgroud)