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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:31:47+00:00 2026-05-29T10:31:47+00:00

I’m really missing what is going on here. Django 1.3. Symptom: the Authentication is

  • 0

I’m really missing what is going on here. Django 1.3.

Symptom: the Authentication is simply busted. I’ve reduced the problem to this:

./manage.py shell
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>from django.contrib.auth.models import User
>>> users = User.objects.all()
>>> users
[<User: jal>]
>>> users[0].set_password('whatever');
>>> users[0].save()
>>> user = auth.authenticate(username="jal", password="whatever")
>>> print user
None

I’m at a loss on this.

Edit:

>>> from django.contrib.auth.models import User
>>> user = User.objects.get(username="jal")
>>> print user
jal
>>> user.check_password('whatever')
False

I’m using the django.contrib.auth.backends.ModelBackend .

Edit two:

>>> print user
jal
>>> print user.is_active
True

Edit three:

Alasdair is right – thank you.

>>> users = User.objects.all()
>>> user = users[0]
>>> user.set_password('whatever')
>>> user.save()
>>> u2 = auth.authenticate(username="jal",  password="whatever")
>>> print u2
jal

This still leaves the mystery as to why it is broken for actually accessing the Django admin GUI, which is why I was headed down this road in the first place. It gives me “Please enter a correct username and password. Note that both fields are case-sensitive” whether or not the password is correct.

  • 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-29T10:31:48+00:00Added an answer on May 29, 2026 at 10:31 am

    You’re having this problem because Django querysets are lazy. Each time you access users[0], Django returns a different object.

    To demonstrate this, try the following:

    >>> users = User.objects.all()
    >>> print id(users[0])
    58753692
    >>> print id(users[0])
    58753111
    

    You can see that the object id is different each time. The object that you save is not the same object that you set the password for. The new password has not been saved to the database, so the authentication fails.

    To get around this, you can use assign users[0] to a variable, or user list() to force the queryset to be evaluated.

    # Assign users[0] to a variable.    
    users = User.objects.all()
    user = users[0]
    user.set_password('whatever')
    user.save()
    
    
    # Force the queryset to be evaluated by using list()
    users = list(User.objects.all())
    users[0].set_password('whatever')
    users[0].save()
    

    Edit: This suggestion was not the problem here, but might help somebody else out.

    what is the value of AUTHENTICATION_BACKENDS in your settings file. You don’t have to define it in your settings.py, as it will default to:

    AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) 
    

    If you have set it to something else, that could cause problems.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.