Tutorial by Examples

Filters allows you to apply a function to a variable. This function may take 0 or 1 argument. Here is the syntax: {{ variable|filter_name }} {{ variable|filter_name:argument }} Filters can be chained so this is perfectly valid: {{ variable|filter_name:argument|another_filter }} If transla...
The simplest way of defining a custom template tag is to use a simple_tag. These are very straightforward to setup. The function name will be the tag name (though you can override it), and arguments will be tokens ("words" separated by spaces, except spaces enclosed between quotes). It eve...
Sometimes what you want to do is just too complex for a filter or a simple_tag. Fow this you will need to create a compilation function and a renderer. In this example we will create a template tag verbose_name with the following syntax: ExampleDescription{% verbose_name obj %}Verbose name of a mo...

Page 1 of 1