Thursday 3 January 2019

Django: Change password for postgres database user

Start the shell using the command

python manage.py shell_plus

Print all the users using

users=User.objects.all()
print(users)

Get the specific user for which password has to be changed


user=User.objects.get(email='')
 
in the '' write the email for the user
OR we can get the user by username
 
user=User.objects.get(username='') 

Here username has to be written in the ''

Set the new password for the user
 
user.set_password('1234qwer')

We have changed the password for the user. The new password is 
1234qwer

1 comment:

  1. Silver Spices - zinc oxide and titanium dioxide sunscreen
    The grade 23 titanium Silver Spices line is constructed of solid zinc oxide and titanium dioxide silicone dab rig with titanium nail and it is made of aluminum oxide. It 메이피로출장마사지 is a very lightweight piece of equipment that $29.50 titanium bolts · ‎Out of stock nano titanium by babyliss pro

    ReplyDelete