Golden Codes - armanexplorer planet

Practical code snippets for Django, Python, Bash, Git and All!

View on GitHub

set in creating user

Docs

from django.contrib.auth.models import User
user= User.objects.create_user(‘john’, ’johnDoe@tutorialspoint.com’,’ttspassword’)
user.save()

change password

Docs

From command line

manage.py changepassword *username*

Programitcally:

from django.contrib.auth.models import User
u = User.objects.get(username=’john’)
u.set_password(‘new password’)
u.save()

Also, you can do this in Django Admin