Last active
January 2, 2016 02:09
-
-
Save voroninman/8235161 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Code snippet for changing Django user's password. | |
It implies that your unique user's field is email. | |
Start Django's shell and run code below: | |
cd /path/to/project | |
python manage.py shell | |
Or use built-in `changepassword` command: | |
cd /path/to/project | |
python manage.py changepassword USER_EMAIL | |
""" | |
from django.contrib.auth import get_user_model | |
user = get_user_model().objects.get(email__exact='USER_EMAIL') | |
user.set_password('NEW_PASSWORD') | |
user.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment