

Django Advent, Day 11: Smart If Template Tag (Chris Beaven) - idan
http://djangoadvent.com/1.2/if-gets-smart/

======
andr
If you haven't tried it yet, I highly recommend the Jinja2 template engine.
It's almost a drop in replacement for Django templates, but has a proper if,
macros and a few other extras. I have a Jinja version of render_to_response()
and I will post it if someone is interested.

~~~
samueladam
If you are choosing the django stack, I would advise staying within the built-
in template system.

Jinja2 is a great project and I wish it was easy to integrate with django.

I tried it through coffin <http://github.com/dcramer/coffin> and got hit by a
few views from the contrib.auth models that had to be rewritten.

If you want to plug django-apps, you will have to patch and maintain them to
work with Jinja2.

Coffin uses a nice trick to reload the view functions code with a Jinja2
version of render_to_response and RequestContext:

[http://github.com/dcramer/coffin/blob/master/coffin/contrib/...](http://github.com/dcramer/coffin/blob/master/coffin/contrib/auth/views.py)

Note that django 1.2 will include 'Smart' if tags and Template caching if that
is what you are looking for in Jinja2:

[http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#s...](http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#smart-
if-tag)

~~~
nek4life
In the 1.2 release notes it states that due to changes made to the template
caching layer it is now much easier to work with non-django template
languages.

[http://docs.djangoproject.com/en/dev/releases/1.2/#template-...](http://docs.djangoproject.com/en/dev/releases/1.2/#template-
caching)

~~~
samueladam
I hope so, but I realized I chose django because it comes with batteries
included.

If you're after Jinja2, wouldn't you find it more interesting to work with a
minimalistic stack like Werkzeug, SqlAlchemy, couchdbkit... ?

