D
D
DjSorry2016-03-25 09:50:02
Django
DjSorry, 2016-03-25 09:50:02

Is there an analogue of inclusion.tag in jinja2?

Good afternoon!
Tell me about this problem: you need to insert several other rendered templates into the base site template.
If the project was on a Dzhang template engine, then it could be written in templatetag/mytag.py

@register.inclusion_tag('results.html')
def show_results(poll):
    ...

and in template
{% load mytag %}
{% show_results poll %}

however, jinja2 does not understand the load tag nor the inclusion.tag.
Tell me, can anyone know a competent solution to this problem for jinja2?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2016-03-25
@DjSorry

Macros

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question