Django does not store raw (clear text) passwords on the user model, but only a hash (see the documentation of how passwords are managed for full details). Because of this, do not attempt to manipulate the password attribute of the user directly. This is why a helper function is used when creating a user.
To change a user’s password, you have several options:
manage.py changepassword *username*
offers a method of changing a user’s password from the command line. It prompts you to change the password of a given user which you must enter twice. If they both match, the new password will be changed immediately. If you do not supply a user, the command will attempt to change the password whose username matches the current system user.
You can also change a password programmatically, using set_password():
from django.contrib.auth.models import User
u = User.objects.get(username='john')
u.set_password('new password')
u.save()
If you have the Django admin installed, you can also change user’s passwords on the authentication system’s admin pages.
Django also provides views and forms that may be used to allow users to change their own passwords.
Changing a user’s password will log out all their sessions. See Session invalidation on password change for details.