Jinja2 templates using Django template tags
I'm using Jinja2 on a new project, but would like to use the django-socialregistration app, which relies on Django template tags. Jinja2 doesn't play nicely with template tags, so I'm wondering if there's a quick workaround?
Template tags:
{% load facebook_tags %} {% facebook_button %} {% facebook_js %}This previous question addresses the same topic for Mako, but I'm having troubl开发者_StackOverflow社区e adapting it to work with Jinja2. The following is my attempt at an adaptation (non-working):
{% from django.template import Template, Context %}
{% tpl = "{% load facebook_tags %}{% facebook_button %}{% facebook_js %}" %}
${Template(tpl).render(Context(dict_=dict(request=request)))}
Any advice? I'm new to inlining, so don't know if the above is even close.
Should the last line not just be:
{% Template(tpl).render(Context(dict=dict(request=request))) %}
精彩评论