Better support for newer environments

Fixes breakage with Django Debug Toolbar 1.x, jQuery 1.1x, and (in tests) Django 1.4 - 1.6