add django 1.5 custom user model support

Support for custom user model in django 1.5, while remaining backwards
compatible.