查看已创建的超级用户
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()
网友评论