The title filter works fine, but if you have a lot of words, for example: "some random text" , the result will be "some random text" . If what you really want is the uppercase only first letter of the entire line, you must create your own custom filter.
You can create such a filter (follow the instructions to create a custom template filter from this doc - it's pretty simple):
# yourapp/templatetags/my_filters.py from django import template register = template.Library() @register.filter() def upfirstletter(value): first = value[0] if len(value) > 0 else '' remaining = value[1:] if len(value) > 1 else '' return first.upper() + remaining
Then you should load the my_filters file into your template and use the filter specified there:
{% load my_filters %} ... {{ myname|upfirstletter }}
Valdir Stumm Junior Jan 11 '13 at 2:48
source share