Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Django tag for ICanHaz.js templates
{# ICanHaz templates #}
{% icanhaz %}
{# inside here all occurrences of "[[" will become "{{" and "]]" will be "}}" #}
<script type="text/html" id="contributor_row">
<select name=role_for_[[ id ]]">
{% for role in roles %}
<option value="{{ }}">{{ }}</option>
{% endfor %}
{% endicanhaz %}
from django import template
register = template.Library()
def icanhaz(parser, token):
nodelist = parser.parse(('endicanhaz',))
return ICanHazNode(nodelist)
class ICanHazNode(template.Node):
def __init__(self, nodelist):
self.nodelist = nodelist
def render(self, context, ):
output = self.nodelist.render(context)
return output.replace('[[', '{{').replace(']]', '}}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.