Django template tags within Jinja2

In some cases it can be useful to enable Django tags within your Jinja2 templates, for example… when you are converting your templates but still have some legacy tags/filters that don’t support Jinja2 or if you are using a project without Jinja2 support.

Luckily, that’s not too difficult to achieve with Jinja2, actually a lot easier than the reverse as discussed in

It should be noted that the Coffin library is used in this example but these imports could easily be replaced with straight up Jinja2.

The actual code:

Now the tag can be used like this:

Bookmark and Share

About Rick van Hattem

Rick van Hattem is a Dutch Internet entrepreneur and co-founder of

One Response to “Django template tags within Jinja2”

  1. APRILIA | 2018-10-23 at 12:34:09 #

    nice information

Leave a Reply