Django Template Language
Django templates not only return static HTML templates but can also add dynamic application data while generating the templates. Along with data, we can also include some programmatic elements in the templates. All of these put together form the basics of Django's template language. This section looks at some of the basic parts of the Django template language.
Template Variables
A template variable is represented in between two curly braces, as shown here:
{{ variable }}
When this is present in the template, the value carried by the variables will be replaced in the template. Template variables help in adding the application's data into the templates:
template_variable = "I am a template variable." <body> {{ template_variable }} </body>
Template Tags
A tag is similar to a programmatic control flow, such as an if
condition or a for
loop...