Just starting to play around with Django and I'm trying to make the content of a block in all uppercase
my base.html template
{% block page-title %}{{ "test123"|upper }}{% endblock %}
and it will output perfectly with TEST123
I would like to make it always uppercase and not having to apply the upper tag each time I want to overwrite it.
For example in my contact.html
{% block page-title %}Contact us{% endblock %}
I want to keep it as DRY as possible and not having to type {{ "Contact us"|upper }} .
I've tried {{ {% block page-title %}{% endblock %}|upper }} but I get a TemplateSyntaxError
You can use the {% filter %} tag to apply a filter to a whole bunch of variables.
{% filter upper %}
A whole bunch of {{ text }} and {{ variables }}
{% endfilter %}
While not addressing your question with Python there is a simple CSS approach (source):
text-transform: uppercase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With