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 3962060
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:03:02+00:00 2026-05-20T03:03:02+00:00

Hello all you helpful people out there (and goodbye none-helpful people :D ). I’m

  • 0

Hello all you helpful people out there (and goodbye none-helpful people 😀 ). I’m trying to create a user in django (1.2.4) and then log them in after saving them. My problem is I’m getting NotImplementedError and looking at the traceback it’s being raised by django.contrib.auth.models.AnonymousUser . Here is part of my view code:

def signup(request):
    if request.method == 'POST': # If the form has been submitted...
        p = request.POST
        if not request.user.is_authenticated():
            form = UserForm(request.POST) # A form bound to the POST data
            if form.is_valid(): # All validation rules pass
                # Process the data in form.cleaned_data
                # ...
                form.save()
                user=authenticate(username=p['username'],password=p['password'])
                login(request,user)
                return HttpResponseRedirect('/') # Redirect after POST

So it looks to me that It’s trying to log in an anymouse user instead of the one I’m authenticating, how can I overcome this?

Thanks
P.S. The users are being created in the database, it just won’t log them in using this code.

Traceback:

Environment:
Request Method: POST
Request URL: http://localhost:8000/signup/
Django Version: 1.2.4
Python Version: 2.6.1
Installed Applications:
[‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.sites’,
‘django.contrib.messages’,
‘django.contrib.admin’,
‘django.contrib.admindocs’,
‘django_extensions’,
‘REDACTED_APPs’,
Installed Middleware:
(‘django.middleware.common.CommonMiddleware’,
‘django.middleware.locale.LocaleMiddleware’,
‘django.contrib.sessions.middleware.SessionMiddleware’,
‘django.contrib.auth.middleware.AuthenticationMiddleware’,
‘django.contrib.messages.middleware.MessageMiddleware’,
‘django.contrib.sessions.middleware.SessionMiddleware’)

 Traceback:    
 File "/Library/Python/2.6/site-packages/django/core/handlers/base.py" in get_response    
   100.                     response = callback(request, *callback_args, **callback_kwargs)    
 File "REDACTED/views.py" in signup    
   19.                 login(request,user)    
 File "/Library/Python/2.6/site-packages/django/contrib/auth/__init__.py" in login    
   71.     user.save()    
 File "/Library/Python/2.6/site-packages/django/contrib/auth/models.py" in save    
   430.         raise NotImplementedError    

 Exception Type: NotImplementedError at /signup/    
 Exception Value:
  • 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-05-20T03:03:03+00:00Added an answer on May 20, 2026 at 3:03 am

    What I think is happening here is authenticate is returning None, therefore login is using request.user (an AnonymousUser).

    It looks like the information used to create the user is different to what you are passing to authenticate. I would double check that the user is being saved correctly (especially the password).

    Edit: From other answers I see you are using a custom user form. You should use django.contrib.auth.forms.UserCreationForm, it’s save() method will set the password correctly.

    The below doesn’t work without manually setting the backend attribute, more trouble than it’s worth, left for posterity

    The easy out is to skip the authenticate step here (it doesn’t add anything important)

    user = UserForm.save()
    login(request, user)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all you math whizzes out there! I am struggling with a math problem
Hello All you Lovely People on stackoverflow, I am trying to plot data using
Hello all how can I create jar file of my project that is created
Hello to all, Double d = 1.000000000000000000000000000000001; System.out.println(d); The code above prints 1.0 but
Hello all, I need to create a query for house search, that would match
Hello all I am getting an error Run-time error '9': Subscript out of range
Hello helpful stackoverflow members, I'm trying to accomplish what seems to be a simple
Hello all I'm trying to convert a string to a double and it doesn't
hello all as I create a form within the openlayers viewer, deployed in the
Hello everyone I'm currently trying to create a deferred renderer for my graphics engine

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.