Easily embed Handlebars.js templates in your django templates
Project description
django-templatetag-handlebars allows you to embed Handlebars.js templates in your django templates.
Most of the template tag code comes from Miguel Araujo’s verbatim snippet.
INSTALL
pip install django-templatetag-handlebars
USAGE
Add templatetag_handlebars to your INSTALLED_APPS
Add the HTML header :
<head> {% include "templatetag_handlebars/head.html" %} ... </head>
Call the template tag :
{% load templatetag_handlebars %} {% tplhandlebars "tpl-infos" %} {{total}} {% trans "result(s)." %} <p>{% trans "Min" %}: {{min}}</p> <p>{% trans "Max" %}: {{max}}</p> {% endtplhandlebars %}
Render your block as usual using Handlebars.js API :
var properties = { total: 10, min: 5, max: 4 }; var template = Handlebars.compile($('#tpl-infos').html()), rendered = template(properties);
LICENSE
Lesser GNU Public License
Handlebars.js is released under the MIT license - Copyright 2011 Yehuda Katz
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-templatetag-handlebars-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcc7e707f01136801e5e63fe1590f3787ec5fc7cee97b074dfe2ff281fd069d5 |
|
MD5 | 867d42dcda5657211119547134a9d217 |
|
BLAKE2b-256 | 6aa224a0b1a8ff090b2c27f976f5ecd6ddb988ade0fd301770d6c692696575fb |