Answers for "create_user() missing 1 required positional argument: 'username'"

0

create_user() missing 1 required positional argument: 'username'

from django.shortcuts import render, redirect
from django.contrib.auth.models import User
# Create your views here.

def index(request):
    return render(request, 'index.html')

def register(request):
    if request.method == 'POST':
        print('hi hello')
        first_name = request.POST['first_name']
        email = request.POST['email']
        password = request.POST['password']
        user = User.objects.create_user(first_name=first_name, email=email, password=password)
        user.save()
        print('user Created')
        user.redirect('/')
    else:
        print('user not created')
        return render(request, 'register.html')
Posted by: Guest on December-21-2020
0

create_user() missing 1 required positional argument: 'username'

from .import views
Posted by: Guest on July-01-2021

Code answers related to "create_user() missing 1 required positional argument: 'username'"

Python Answers by Framework

Browse Popular Code Answers by Language