Update to support a custom user model

Django 1.5 compatibility
PEP8 fixes