我有点困惑它是如何工作的。我已经完成了用mongoengine替换Django的默认身份验证的所有步骤,以便它使用mongodb和数据库,但是我试图创建一个注册页面,但无法弄清楚如何使用超级用户功能。我目前正试图你如何创建一个使用mongoengine的超级用户?
newuser = UserManager.create_superuser(username=request.POST['username'],
password=request.POST['password'],
email=request.POST['email'])
newuser.save()
但我一直给我的错误
TypeError at /registerSuper/
unbound method create_superuser() must be called with UserManager instance as first argument (got nothing instead)
当我尝试这一点,告诉我 “查询集”对象有没有属性“create_superuser” –
我从来没有使用MongoEngine。正如@Elliott上面提到的,这条线是否工作? 'MongoUser.objects.create_superuser()'? –
那么mongoengine用户类也称为用户。我只是确保导入,而不是django的。所以我给出的例子是使用mongoengine用户类 –