class Template
[source]
This class lives at django.template.Template
. The constructor takes one argument — the raw template code:
1 2 3 | from django.template import Template template = Template( "My name is {{ my_name }}." ) |
Behind the scenes
The system only parses your raw template code once – when you create the Template
object. From then on, it’s stored internally as a tree structure for performance.
Even the parsing itself is quite fast. Most of the parsing happens via a single call to a single, short, regular expression.
Please login to continue.