I am trying to convert to upper case a string in a Jinja template I am working on.
In the template documentation, I read:
upper(s)
Convert a valu
And you can use: Filter like this
{% filter upper %}
UPPERCASE
{% endfilter %}
for the capitalize
{{ 'helLo WOrlD'|capitalize }}
output
Hello world
for the uppercase
{{ 'helLo WOrlD'|upper }}
output
HELLO WORLD
Filters are used with the |filter syntax:
{% elif student.department|upper != "MATHS DEPARTMENT" %}
Maths department
{% endif %}
or you can use the str.upper() method:
{% elif student.department.upper() != "MATHS DEPARTMENT" %}
Maths department
{% endif %}
Jinja syntax is Python-like, not actual Python. :-)