Better support for custom user models

Replaced straight import of User with the Django 1.5 way, but still some work to do as custom user models don't necessarily have a username field, which is used all over the place.