How to allow users to change their own passwords in Django?

Django comes with a user
authentication system. It handles user
accounts, groups, permissions and
cookie-based user sessions. This
document explains how things work.

How to change Django passwords

See the Changing passwords section

  1. Navigation to your project where manage.py file lies

  2. $ python manage.py shell

  3. type below scripts :

from django.contrib.auth.models import User
u = User.objects.get(username__exact="john")
u.set_password('new password')
u.save()

You can also use the simple manage.py command:

manage.py changepassword *username*

Just enter the new password twice.

from the Changing passwords section in the docs.


If you have the django.contrib.admin in your INSTALLED_APPS, you can visit: example.com/path-to-admin/password_change/ which will have a form to confirm your old password and enter the new password twice.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)