Django 1.3 fixes

Fix some of the incompatible changes between Django 1.3 and 1.6