Skip to content Skip to sidebar Skip to footer

Django Error: Create_user() Takes At Least 2 Arguments (3 Given)

I'm a newbie with Django, sorry for the silly question, but I get this error when I try to do the user registration : create_user() takes at least 2 arguments (3 given) in the lin

Solution 1:

The create_user() function takes the username as a positional argument:

user= User.objects.create_user(
    form['username'], first_name=form['first_name'], 
    last_name=form['last_name'], password=form['password'], 
    email=form['email'])

You can still pass it in as a keyword argument, but then you need to call it username, not user:

user = User.objects.create_user(
    username=form['username'], first_name=form['first_name'], 
    last_name=form['last_name'], password=form['password'], 
    email=form['email'])

Post a Comment for "Django Error: Create_user() Takes At Least 2 Arguments (3 Given)"