Support for Django 1.5 custom user models

Uses get_user_model for every reference to User, and provides a default
implementation of get_user_model for Django <= 1.4