I know most of all have fallen prey to setting a ridiculously hard password to our admin panels, saving them somewhere and loosing the password due to forgetfulness, or one of the other many reasons we lose our passwords.
This happened to me while working through a Django tutorial and I just want to document how I was able to solve it.
1) Access your python shell using:
python manage.py shell
This little code snippet will bring up your python shell development.
2) Next thing we will do is to get the lists of users and this can by done by:
a: Import Users from Django auth:
from django.contrib.auth.models import User
b: Assign Users objects to a variable and print it:
users = User.objects.all()
print users
This prints out the total users in your application, and you can select which is your admin. Generally though, the admin user is often always the first user created.
3) Select the ‘id’ of the admin user:
user = users[0]
4) Set a new password for the user:
user.set_password('the password')
5) Save the new password:
user.save()
Top comments (4)
Thanks, I had this issue once, I had to delete the project and start again... Thanks for showing an easier way for fixing this.
When you encounter any problem while using your Lexmark printer, avail support by dialing the Lexmark printer support toll-free number. The customer support service can be reached out for all technical issues.
Click This Link :- printer-customer-support.com/lexmark/
well thanks , i was having trouble with the same
crumbles.co/showbox-apk-download/
There is convenient management command for that:
python manage.py changepassword