Replaced a hard reference to the now depricated User model with code to use the settings.AUTH_USER_MODEL, if available.