made compatible with custom user model for django 1.5