扩展 Django 管理员登录(用户名、密码、站点)
我正在尝试扩展 Django 管理员登录。大多数资源都指向登录后扩展视图。
我想将网站添加到登录条件中。
因此,而不是
- 用户名
- 密码
它将是
- 用户名
- 密码
- 站点
这样站点将检查用户是否以管理员身份属于该站点,如果是,它将仅加载属于该站点的数据。
谢谢
干杯, 米奇
I'm trying to extend Django Admin Login. Most of the resources pointed towards extending views after the Login.
I wanted to add sites to the Login criteria.
So instead of
- Username
- Password
It will be
- Username
- Password
- Site
Such that the Site will check whether the user belongs to the Site as admin and if it is, it will load only data belongs to the site.
Thanks
Cheers,
Mickey
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定,因为我是 django 的新手。
我将从项目文件夹中的原始 django 代码中复制管理代码。然后我会按照您想要的方式更改它并将其放入已安装的应用程序中。
我希望,我能帮助你。正如我所说,我是 django 的新手。
克拉猎手
I am not sure because I am newbee in django.
I would copy the admin code from the original django code in my profject folder. Then I would change it like you want it and put it in installed apps.
I hope, I could help you. As I said, I am a newbee in django.
Craphunter
为此,您使用用户配置文件 。
这是一个基本示例(此代码将位于您应用的
models.py
中):You use user profiles for this.
Here's a basic example (this code would go in your app's
models.py
):