美文网首页
Django的摘抄

Django的摘抄

作者: 一碗好吃的乌冬面 | 来源:发表于2019-01-02 00:36 被阅读0次

    查看已创建的超级用户

    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的摘抄

          本文链接:https://www.haomeiwen.com/subject/hkkalqtx.html