The first one — {% elif event|lookup:'Item Count' > 1 && < 4 %} — won’t work, as each individual condition needs to be fully formed, i.e. you need to repeat event|lookup:'Item Count'.
The second one should work. We’ve seen issues recently where < and > were getting encoded as HTML entities < and %gt;
Is that happening here? If you save the block and go back to edit it, do you see the < and > now escaped?
If so, we do have django filters gt and lt you can try:
gt | Use this filter to return the value of the expression "item is greater than value" (item > value) where item is passed first and value is passed second. | {% if 3|gt:2 %} <p>3 is greater than 2</p> {% endif %} {% if 2|gt:3 %} <p>2 is greater than 3</p> {% endif%}
| |
lt | Use this filter to return the value of the expression "item is less than value" (item < value) where item is passed first and value is passed second. | {% if 2|lt:3 %} <p>2 is less than 3</p> {% endif %} {% if 3|lt:2 %} <p>3 is less than 2</p> {% endif %} | |
… The second one should work. We’ve seen issues recently where < and > were getting encoded as HTML entities < and %gt;
Is that happening here? If you save the block and go back to edit it, do you see the < and > now escaped? …
Not that I recall. It all looked clean, as I went back into the block several times to make tweaks and re-test. But… that doesn’t mean they couldn’t have been encoded.
And now, things have changed with that particular email, as it turns out we weren’t able to return the desired data that this section was written for in the first place, so it’s all moot now. However, my curiosity won’t let me rest on this, so I may create a test email to try this out on—I like things to be resolved. I’ll report back here with my findings.
Thanks for your response.
The ‘greater than’ / ‘less than’ signs were not being encoded to HTML entities; it was the double ampersand causing the error. When I changed “&&” to “and”, everything worked as intended.
Thanks again for your input.