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

  • SEARCH
  • Home
  • 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 7869153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:13:44+00:00 2026-06-03T01:13:44+00:00

I want to add user in a Django app. here’s my code, it fires

  • 0

I want to add user in a Django app. here’s my code, it fires an exception in this line

user = User.objects.create(userName, userMail, userPass)

Here’s the whole code:

def createUser(request):
    userName = request.REQUEST.get('username', None)
    userPass = request.REQUEST.get('password', None)
    userMail = request.REQUEST.get('email', None)

    # TODO: check if already existed

    user = User.objects.create(userName, userMail, userPass)
    user.save()

   return render_to_response('home.html', context_instance=RequestContext(request))

Any help?

  • 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-03T01:13:45+00:00Added an answer on June 3, 2026 at 1:13 am

    Use the create_user helper function instead of the create method. It takes care of hashing the password for you, amongst other things.

    user = User.objects.create_user(userName, userMail, userPass)
    

    As an aside, fetching the values out of the request data dictionary isn’t best practice. It’s a good idea to learn about django forms and model forms, which will validate input data for you. Once you understand that, there’s a UserCreationForm included with the django auth app which you could use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We alert user using this javascript, now i want to add this functionality to
I want do debug this line: exec(mysqldump --add-drop-table -h 127.0.0.1 -u$db_user -p$db_pass $db_name >
I want to add a new function to the default User model of Django
So I'm creating a django app that allows a user to add a new
I want to add a convenience/model method to the django.contrib.auth.models.User model. What is the
I want to monkey patch the user model from Django. My code: from django.db
I want this code to display list of friends of a user, list of
I just finished a Django app that I want to get some outside user
In my view I want to add the text user enter in a textarea
I have html form and I want to add validation on user input -

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.