📅  最后修改于: 2022-03-11 14:46:58.243000             🧑  作者: Mango
from django.contrib.auth.models import User
password = User.objects.make_random_password()
user.set_password(password)
user.save()