- Author:
- hugogee
- Posted:
- August 24, 2011
- Language:
- Python
- Version:
- Not specified
- Score:
- -4 (after 4 ratings)
Reset lost django password without the use of sql.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Credit goes to colewhitelaw.com for most of this solution.
# start an interactive shell-this assumes you are in the right directory
python manage.py shell
>>> from django.contrib.auth.models import User
# Grab all users and output
>>> userlist = User.objects.all()
>>> userlist
[< User:yourusername >]
# Refer to your required user by index and set new password
>>> userlist[0].set_password('newpasswd')
# Then save it
>>> userlist[0].save()
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 10 months, 1 week ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 10 months, 2 weeks ago
- Serializer factory with Django Rest Framework by julio 1 year, 5 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 6 months ago
- Help text hyperlinks by sa2812 1 year, 6 months ago
Comments
Better get the user directly:
or just use whats already built-in:
#
Please login first before commenting.