Django删除超级用户 [英] Django delete superuser

查看:124
本文介绍了Django删除超级用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是重复的,但是我在任何地方都找不到问题,所以我将继续询问:

This may be a duplicate, but I couldn't find the question anywhere, so I'll go ahead and ask:

是否有一种简单的删除方法终端中的超级用户,也许类似于Django的 createsuperuser 命令?

Is there a simple way to delete a superuser from the terminal, perhaps analogous to Django's createsuperuser command?

推荐答案

没有内置命令,但是您可以从shell中轻松完成此操作:

There's no built in command but you can easily do this from the shell:

> python manage.py shell
$ from django.contrib.auth.models import User
$ User.objects.get(username="joebloggs", is_superuser=True).delete()

这篇关于Django删除超级用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆