To use in dev environments
- after
python manage.py shell
from django.contrib.auth.models import User
# dev environ with only a few users
l = User.objects.all()
# show user list
print(l)
# get the 1st user
u = l[0]
# set the password
u.set_password('123') # for dev
u.save()
- Only differs by initial import on 1st line
from tworaven_apps.raven_auth.models import User
# dev environ with only a few users
l = User.objects.all()
# show user list
print(l)
# get the 1st user
u = l[0]
# set the password
u.set_password('123') # for dev
u.save()
Instead of showing all users, you can search by id, username or email
l = User.objects.get(username='someone')
or
l = User.objects.get(email='[email protected]')
or
l = User.objects.get(id=3)
in this case, Username or email must be unique to get object