没有 Auth 应用程序的 Scaffold 或 django-admin

发布于 2024-07-18 15:34:04 字数 189 浏览 2 评论 0原文

我创建了自己的身份验证应用程序,但现在管理员无法工作,您有什么建议?

现在的例外是:“用户”对象没有属性“is_authenticated”

我知道我的用户确实没有这样的方法。 所以我有2种方法: - 更改管理员 - 调整我的用户系统

我的问题是:是否有可能轻松关闭管理员绑定到身份验证

I created my own Auth app, and now Admin is not working, what can you suggest?

Exception now is: 'User' object has no attribute 'is_authenticated'

I know my User really have no such method. So I have 2 ways:
- change admin
- adapt my user system

My question was: is there possibility to easily off admin bound to auth

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧城烟雨 2024-07-25 15:34:04

请参阅文件 django/contrib/admin/views/decorators.py:

from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login

这些在装饰器 staff_member_required 中使用,它保护对管理应用程序的访问。

管理应用程序需要 django.contrib.auth - 您可能会尝试对其进行猴子补丁,但这是一个坏习惯(Django 不是 RoR,Python 不是 Ruby)。

See the file django/contrib/admin/views/decorators.py:

from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login

These are used in decorator staff_member_required which guards access to admin application.

Admin application requires django.contrib.auth - you might try to monkeypatch it, but it's a bad habit (Django is not RoR, Python is not Ruby).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文