简体   繁体   English

django janja 比较数据库值

[英]django janja compare database value

I have some data store in the database In boolean. I want to check if the value is True pick the value and perform some action on it.我在 boolean 的数据库中有一些数据存储。我想检查该值是否为 True 选择该值并对其执行一些操作。

product: "{{DB_report_query.product.name}}"
{% if DB_report_query.product.summary  == True %}
{{DB_report_query.summary}}
{% endif %}

But this does not work.但这不起作用。

If it is a BooleanField then simply use the following:如果它是BooleanField ,那么只需使用以下内容:

{% if DB_report_query.product.summary %}
    {{DB_report_query.summary}}
{% endif %}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM