Is there a simpler way to add a user than with the following pattern?
try:
new_user = User.objects.create_user(username, email, password)
except
This method should solve this problem but keep in mind that in the database, password is kept as a hash of the password, and as pointed before, "get_or_create" makes an exact lookup. So before the lookup actually happens, we "pop" the password from the kwargs. This method on your custom UserManager:
def get_or_create(self, defaults=None, **kwargs):
password = kwargs.pop('password', None)
obj, created = super(UserManager, self).get_or_create(defaults, **kwargs)
if created and password:
obj.set_password(password)
obj.save()
return obj, created