Add support for custom User model

Adds support for use of a custom User model in django 1.5 while still
maintaining backwards compatibility with 1.4 and 1.3.