[Fixed]-Django {% if custom_template_tag > 0 %} does not work

1👍

The test2 inside that if statement does not actually call a template tag; it can only refer to a (non-existent) context variable. That’s why the assignment tag works, because you do actually set such a variable.

If you don’t like the assignment tag, you might consider doing the whole comparison inside the tag, so that it outputs the Test1/Test2 value directly.

Leave a comment