TypeError: generate_user_key() missing 1 required positional argument: 'self' code example

Example: 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')