How do we retrieve a password of an user?
u = User.objects.get(username__exact=username) print u.password
displays sha1$f0971$441cac8
sha1$f0971$441cac8
You can check if the password is correct with:
u.check_password("your password")
This method and u.set_password("you password") solves all of your problems.
u.set_password("you password")
sha1$f0971$441cac8f604d49869e33ca125a76253a02fef64e is:
sha1$f0971$441cac8f604d49869e33ca125a76253a02fef64e
hash function algorithm $ salt $ hash code
$