django-icanhaz

Software Screenshot:
django-icanhaz
Software Details:
Version: 0.2.0
Upload Date: 11 May 15
Developer: Carl Meyer
Distribution Type: Freeware
Downloads: 0

Rating: nan/5 (Total Votes: 0)

django-icanhaz is a templatetag for easier integration of ICanHaz.js JavaScript templates with Django templates.

Installation

Install from PyPI with pip:

pip install django-icanhaz

or get the in-development version:

pip install django-icanhaz==dev

Usage

- Add "icanhaz" to your INSTALLED_APPS setting.
- Set the ICANHAZ_DIR setting to the full (absolute) path to a directory where you will store your ICanHaz templates.
- {% load icanhaz %} and use {% icanhaz "templatename" %} in your Django templates to safely embed the ICanHaz.js template at ICANHAZ_DIR/templatename.html into your Django template, automatically wrapped in , ready for ich.templatename({...}) in your JavaScript.

django-icanhaz does not bundle ICanHaz.js or provide any JavaScript utilities; it just helps you easily embed the templates in your HTML. Include ICanHaz.js in your project's static assets and use it in your JS as usual.

Philosophy

The collision between Django templates' use of {{ and }} as template variable markers and ICanHaz.js' use of same has spawned a variety of solutions. One solution simply replaces [[ and ]] with {{ and }} inside an icanhaz template tag; another makes a valiant attempt to reconstruct verbatim text within a chunk of a Django template after it has already been mangled by the Django template tokenizer.

I prefer to keep my JavaScript templates in separate files in a dedicated directory anyway, to avoid confusion between server-side and client-side templating. So my contribution to the array of solutions is essentially just an "include" tag that avoids parsing the included file as a Django template (and for convenience, automatically wraps it in the script tag that ICanHaz.js expects to find it in).

Enjoy!

What is new in this release:

  • Made template-finding more flexible: ICANHAZ_DIR is now ICANHAZ_DIRS (a list); added ICANHAZ_FINDERS, ICANHAZ_APP_DIRNAMES, and finding of templates in installed apps.

Requirements:

  • Python
  • Django

Other Software of Developer Carl Meyer

django-secure
django-secure

14 Apr 15

hgcampfire
hgcampfire

15 Apr 15

django-markitup
django-markitup

11 May 15

Comments to django-icanhaz

Comments not found
Add Comment
Turn on images!