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
I don't think so. But you can proxify the Django User:
class MyUser(User):
class Meta:
proxy = True
def get_or_create(self, username, email, password, *args, **kwargs):
try:
new_user = User.objects.create_user(username, email, password)
except IntegrityError:
return User.objects.get(username=username, email=email)
else:
new_user.first_name = kwargs['first_name'] # or what you want
...etc...
return new_user