upper Filter

Formatting

Documentation

Uppercases the first letter of a value.

 

Variable

greeting = 'hello, world!'

Template

{{ greeting|upper }}

Result

HELLO, WORLD!

Commentary

For web pages, formatting tags like this are not too useful. We prefer using CSS's text-transform: uppercase property. However, there is an advantage to using Django: because the formatting is applied server-side, the value returned to the client will already be formatted appropriately. If the client does not support CSS or has CSS turned off, that will not affect the formatting.

And, of course, if you are using Django to output plain text or some other non-HTML format, formatting filters could come in handy.


Did we get something wrong? Is there a use case for the upper filter that we should add? Please let us know.

Send Feedback

Official Documentation
This page last updated on April 9, 2023, 1:30 p.m. EST