jsonify: Django custom template filter

This template filter converts the filtered variable to json. I added comment to that snippet to:

1. Pass a kwarg cls=ModelJSONEncoder to simplejson.dumps to get handling of django.db.models.Model objects (get ModelJSONEncoder here). And as sk1p pointed out, you’ll also get handling of datetime objects and decimals for free.

2. Put jsonify.is_safe=True after register.filter so you don’t need to do {% autoescape off %} or |safe every time you use jsonify.

Django captcha app

Thousand thanks to Martin Winkler for making an ultra-useful captcha app for django here. It’s super-easy to use although if you want to use it with Django 1.1 you need to modify it first.

I made the patch for Django 1.1 compatibility, which can be downloaded here.

I also made some other patches to remove md5 deprecation warning (here) and to fix a font-loading bug if you use the app with Subversion/git/some other VCS (here).

UPDATE: It seems that Martin’s site does no longer exist, so I put the Martin’s originals along with all my patches on github.