[Fixed]-Django, register user with first name and last name?

41👍

I did it :

new_user = User.objects.create_user(username, email, password)
new_user.is_active = False
new_user.first_name = first_name
new_user.last_name = last_name
new_user.save()
👤Asinox

12👍

I know you found a way around, but this way below may also interest you.
This is because it requires keywords arguments (which will be passed to the User’s __init__ method).
https://docs.djangoproject.com/en/3.2/ref/contrib/auth/#manager-methods

User.objects.create_user("user1", "user1@foo.bar", "pwd", first_name="First", last_name="Last")

Leave a comment