简体   繁体   中英

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.

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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