updated code for django 1.5 custom user compatibility