How does the "Python" Django auth change the password?

Source: Internet
Author: User

Using the example
1. Create a user
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user (' John ', ' [email protected] ', ' Johnpassword ')
# at the this point, user was a user object that has already been saved
# to the database. You can continue to the change of its attributes
# If you want to the change of other fields.
>>> User.is_staff = True
>>> User.save ()
2. Change the password
>>> from django.contrib.auth.models import User
>>> u = User.objects.get (username__exact= ' John ')
>>> u.set_password (' New password ')
>>> U.save ()
Create a Super Administrator
manage.py createsuperuser--username=joe [email protected]

Front End effect:

Resources:

The users permission system in Django: http://blog.chinaunix.net/uid-25525723-id-331051.html

self-made Change Password page, automatically eject something unwanted : http://mozilla.com.cn/thread-329027-1-1.html

How does the "Python" Django auth change the password?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.