March 2020
Intermediate to advanced
608 pages
17h 17m
English
The {% parse %} template tag allows you to parse a value as a template and render it immediately or store it in a context variable.
If we have an object with a description field, which can contain template variables or logic, we can parse and render it using the following code:
{% load utility_tags %}{% parse object.description %}
It is also possible to define a value to parse using a quoted string, as shown in the following code:
{% load static utility_tags %}{% get_static_prefix as STATIC_URL %}{% parse "{{ STATIC_URL }}site/img/" as image_directory %}<img src="{{ image_directory }}logo.svg" alt="Logo" />
Let's take a look at the code of the {% parse %} template tag. The parsing function checks the arguments of the template ...
Read now
Unlock full access