I needed to reset the django admin password and found this page which tells us how to do this. It did not work for me, however I tried to get the user object explicitly, reset the password and save it and it worked!
Here is a session describing the behavior:
> python manage.py shell
In : from django.contrib.auth.models import User
In : u=User.objects.all()
In : u.password
In : u.set_password('testme')
In : u.save()
In : u.password
In : q=User.objects.get(id=1)
In : q
Out: <user : root>
In : q.set_password('testme')
In : q.save()
In : q.password
Maybe this is related to queryset caching, which would print the same password even after calling set_password. But it looks like in the first method, the password does not even get written to the database. This might be a bug. I will need to run more tests and report (or possibly patch) it...
Update: Perhaps I am not clear in the above post. The weirdness is that in the above two scenarios u and q should essentially reference the same user object, but calling set_password (and later save) method on the u reference does not seem to work (i.e. the password attribute remains unchanged and changed password cannot be used on the admin pages) but calling the same method on q reference seems to work!
Update2:I got it finally. Thanks all (Esp SmileyChris) ! every array slice is a new query! so in the first solution, I need this to make it work:
u.password # to display current hash (Query #1)
q=u # (Query #2)
u.password # (Query #3) this should print updated hash!