How to Negate in this Jinja if condition?

Question:

I have this in template:

{% if cell %}{% set cell = "b" %}{% endif %}

What is contradiction of above conditional?

This not works:

{% if !cell %}
Asked By: parmer_110

||

Answers:

You might use not word, consider following simple example

import jinja2
template = jinja2.Template('cell {% if not cell %}negated{% endif %}')
print(template.render(cell=True))  # cell 
print(template.render(cell=False))  # cell negated
Answered By: Daweo
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.