django-templatetag-handlebarsEasily embed Handlebars.js templates in your Django templates | |
Download |
django-templatetag-handlebars Ranking & Summary
Advertisement
- License:
- LGPL
- Price:
- FREE
- Publisher Name:
- Mathieu Leplatre
- Publisher web site:
- http://mathieu-leplatre.info
django-templatetag-handlebars Tags
django-templatetag-handlebars Description
django-templatetag-handlebars is a Django app that allows you to embed Handlebars.js templates in your Django templates.Most of the template tag code comes from Miguel Araujo's verbatim snippet.INSTALLpip install django-templatetag-handlebarsUSAGE- Add templatetag_handlebars to your INSTALLED_APPS- Add the HTML header :{% load templatetag_handlebars %}< head >{% handlebars_js %}...< /head >- Call the template tag, and write your Handlebars template :{% tplhandlebars "tpl-infos" %} {{total}} {% trans "result(s)." %} < p >{% trans "Min" %}: {{min}}< /p > < p >{% trans "Max" %}: {{max}}< /p >{% endtplhandlebars %}- The following block with end-up in your page :< script id="tpl-infos" type="text/x-handlebars-template" > {{total}} result(s). < p >Min: {{min}}< /p > < p >Max: {{max}}< /p >< script >- Render it, client-side, as usual using Handlebars.js API :var properties = { total: 10, min: 4, max: 5};var template = Handlebars.compile($('#tpl-infos').html()), rendered = template(properties);- Your rendered string is ready, and waiting to be inserted in your DOM10 result(s).< p >Min: 4< /p >< p >Max: 5< /p >Product's homepage
django-templatetag-handlebars Related Software