Django的摘抄

查看已创建的超级用户

python manage.py shell

from django.contrib.auth.models import User
user = User.objects.filter(is_superuser = True)
print(user)

更改超级用户密码

python manage.py shell

from django.contrib.auth.models import User
user = User.objects.get(username = 'username')
user.set_password('new_password')
user.save()

删除超级用户

python manage.py shell

from django.contrib.auth.models import User 
User.objects.get(username="joebloggs", is_superuser=True).delete() 

你可能感兴趣的:(Django的摘抄)