Does django templates support functions?
Can I write them inline within the template?
If I can, how?
2 Answers
No. The idea of Django templates is that they only display information (more or less). More complicated constructs (like functions) must be defined elsewhere.
But, you can create your own template tags or template filters (in Python code) and then use them in your template. They kind of act like functions. Their definition is not within your template, though.
You can read about it in django documentation
Comments
You can call method without arguments: stackoverflow answer
You can do it by using (.) dot notation. read more about variables in Django reference
Use a dot (.) to access attributes of a variable. Technically, when the template system encounters a dot, it tries the following lookups, in this order:
Dictionary lookup Attribute lookup Method call List-index lookup