Django 1.5 Custom User model support

Added compatibility for both Django Custom User models and pre-Django 1.5
User models

Manual merge from bae52c8dafcda1de9344c277f638a7e62663c40b

Signed-off-by: Patrick Taylor <patricktaylor@mac.com>
Signed-off-by: Alex Chiang <alex@chizang.net>