Various fixes and Django 1.5 compat.

I fixed a couple fo things for Django 1.5 compat, including tests.
Note that I bootstraped them to be usable with py.test:

$ pip install pytest pytest-django-lite
$ py.test plans