reset django password

 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

  1. Password Reset Form Newforms by glisha 7 years ago
  2. Simple E-mail registration by bthomas 5 years, 5 months ago
  3. MySQL django password function by mcosta 4 years, 10 months ago
  4. Reset / Send account details email by Ciantic 3 years, 8 months ago
  5. EncryptField by volksman 5 years, 7 months ago

Comments

bartTC (on August 24, 2011):

Better get the user directly:

User.objects.get(username='root')

or just use whats already built-in:

manage.py changepassword [username]

#

(Forgotten your password?)