Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:44:07+00:00 2026-06-11T09:44:07+00:00

I wanted to insert the user details in auth_user table, but it gives the

  • 0

I wanted to insert the user details in auth_user table, but it gives the error of create_user() got an unexpected keyword argument ‘first_name’

forms.py

from django import forms
from django.contrib.auth.models import User
from django.forms import ModelForm
from customer_reg.models import Customer

class Registration_Form(ModelForm):
       first_name  = forms.CharField(label=(u'First Name'))
       last_name   = forms.CharField(label=(u'Last Name'))      
       username   = forms.CharField(label=(u'User Name'))
       email      = forms.EmailField(label=(u'Email Address'))
       password   = forms.CharField(label=(u'Password'), widget=forms.PasswordInput(render_value=False))

       class Meta:
              model=Customer
              exclude=('user',)

       def clean_username(self):
                username=self.cleaned_data['username']
                try:
                      User.objects.get(username=username)
                except User.DoesNotExist:
                      return username
                raise forms.ValidationError("The Username is already taken, please try another.")
       def clean_password(self):
                password=self.cleaned_data['password']
                return password

views.py

from django.contrib.auth.models import User
from customer_reg.models import Customer
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from customer_reg.forms import Registration_Form


def CustomerRegistration(request):
    if request.user.is_authenticated():
        return HttpResponseRedirect('/customer_profile/')
    if request.method == 'POST':
        form = Registration_Form(request.POST)
        if form.is_valid():
            user=User.objects.create_user(first_name=form.cleaned_data['first_name'], last_name=form.cleaned_data['last_name'], username=form.cleaned_data['username'], email=form.cleaned_data['email'], password = form.cleaned_data['password'])

            user.save()

            customer=user.get_profile()
            customer.birthday=form.cleaned_data['birthday']
            customer.website=form.cleaned_data['website']
            customer.store=form.cleaned_data['store']
            customer.welcomemail=form.cleaned_data['welcomemail']
            customer.save()

            return HttpResponseRedirect('/customer_profile/')
        else:
                return render_to_response('customer_register.html',{'form':form} , context_instance=RequestContext(request)) 
    else:
        ''' user is not submitting the form, show them a blank registration form '''

            form = Registration_Form()
            context={'form':form}
            return render_to_response('customer_register.html',context , context_instance=RequestContext(request))

If I edit the views.py as

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

then it works successfully

I have already tried firstname as well as first_name

any idea where I have done the mistake

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:44:08+00:00Added an answer on June 11, 2026 at 9:44 am

    The create_user manager method only accepts three arguments, username, email (optional), and password (optional).

    Once you have created a user, you can modify the other fields, then save again.

    user=User.objects.create_user(username=form.cleaned_data['username'], email=form.cleaned_data['email'], password = form.cleaned_data['password'])
    user.first_name = form.cleaned_data['first_name']
    user.last_name = form.cleaned_data['last_name']
    user.save()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to create a user registration page but it found out a difficult.
I wanted to insert multiple records in MS Access file from java Servlet. The
I wanted to insert a li tag in the middle of a list of
I am just simply creating a web application. I wanted to insert a line
I just wanted to know, if there is any technique to insert values into
Wanted to know if there was a way one could query shelveset details from
I have a table with 4 columns. I want to be able to INSERT
I have an ASP.NET wizard where a user fills in their personal details and
Let's say I wanted to display a Reminder (dynamically created by user) in my
I have a table with three fields - userID, couponID, last_couponID. When the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.