Wagtail + Jinja2

157 views
Skip to first unread message

Arthur Rio

unread,
Sep 24, 2015, 8:09:09 PM9/24/15
to Wagtail support
Hi,

We were using Jinja2 on our website and wanted to use the same for our CMS pages so I made those two tags: https://github.com/minervaproject/wagtail-jinja2.
We are currently using them and it works great but I would love your feedback as it is the first time I make Jinja2 extensions. Also, one difference with the original
image tag is that I'm not using @cache_property on the filter because I couldn't make it work (all images across the page would have the same filter_spec).
Finally, one thing I'd like to improve is a way to render the rich text and blocks automatically wrapped with jinja2.Markup instead of having to use a function.

Thank you in advance for your feedback, we love wagtail!

Arthur Rio
Minerva Project, Inc

Tim Heap

unread,
Sep 30, 2015, 5:05:41 AM9/30/15
to wag...@googlegroups.com
Hi Arthur,

I like what you are doing! I have some thoughts myself on how to integrate with Jinja2. Instead of making a module, I just modified Wagtail itself and submitted a PR: https://github.com/torchbox/wagtail/pull/1755

The most notable difference between our implementations is that I added the Wagtail template tags as functions in Jinja, instead of using the template tag syntax. This seems to be the preferred method in Jinja, where template tags are reserved for changes to template parsing and other low level operations.

I also used the default Jinja integration that comes with Django 1.8, rather than relying on the django-jinja package.

What do you think?

Regards,
Tim

--
You received this message because you are subscribed to the Google Groups "Wagtail support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wagtail+u...@googlegroups.com.
To post to this group, send email to wag...@googlegroups.com.
Visit this group at http://groups.google.com/group/wagtail.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/52ce5f86-1a1a-475d-8a8e-5c8ae663fc37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages