问题描述
我正在创建自己的表单来注册用户,但是我如何才能在其中创建超级用户,我也知道django允许您在如下视图中调用用户: reques.user.username
.我只能在Django表单中使用它,也可以在我的表单中使用它
I am creating my own form to register users, but how can I make possible to create superusers in it, and also I know django allows you, call user in the views like this:reques.user.username
. I can only use that using django forms or I can also use that with my forms
我创建自己的表单是因为我不想拥有Django密码,有没有办法改变它,否则就不要创建自己的表单了
I creating my own form because I don´t want the restriccion django password have, is there a way to change that, in oder to not create my own form
推荐答案
您可以运行命令
python manage.py createsuperuser
其他方法是在保存用户数据时
Other way is that while saving User data make
is_superuser = True
输入密码
您需要从 AbstractBaseUser
继承,然后覆盖该密码字段,并且需要更新其哈希值,不知道您将如何管理该东西,但是可以使用不同的哈希值.
you need to inherit from AbstractBaseUser
and then override that password field and needed to update it's hash, don't know how you will manage that thing but different hash are available.
这篇关于如何在我自己的用户表单中创建超级用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!