Fixes for Django 1.5

See https://code.djangoproject.com/ticket/18899 for more information.

Additionally, the Site.objects.. call didn't work for me as written, so
I made it occur in a closure.
Merge pull request #21 from philipn/django_15_fixes

Fixes for Django 1.5