Add support for custom User models

See:
https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#referencing-the-user-model

Using `getattr` so this will still work in versions of Django older than 1.5