在 Django 中实现多个管理级别
我决定将一个项目从 PHP 迁移到 Python,尽管进行了数小时的搜索,但我找不到实现以下设计的方法。我尝试扩展用户类并进行自定义管理站点,但没有真正发挥任何作用。
我自己在根本层面上。我管理“客户”,而客户自己管理“客户”。 客户控制着一种详细的调查,用户和受邀者都参与其中。
粗略设计的一个例子:
- ME(超级用户)
- 客户
- 客户
- 调查收集
- 用户
- 受邀者
- 调查
- 受邀者(受邀者是调查和用户的子级)
- 问题
- 等等
- 用户
- 客户
我不确定最佳实施方式。我喜欢 django 管理界面,但我需要客户只能修改他们的客户、调查集等,客户只能管理他们自己的调查集等。
有没有办法在 Django 中实现这一点,也许可以通过继承自定义用户类型并为其分配自定义管理站点?
我知道制作自己的应用程序来管理各种“管理”界面可能会更容易,在这种情况下,是否有一种简单的方法来管理这些用户类型及其各种管理风格管理系统的单独身份验证?
I have decided to move a project from PHP to Python and despite hours of searching, I cannot find a way to implement the following design. I have attempted extending the user class and doing customised Admin Sites but not really got anywhere useful.
I have at the root level, myself. I manage 'clients', who themselves manage 'customers'.
The customers control a kind of detailed survey, in which users and invitees take part.
An example of the rough design:
- ME (Super User)
- Clients
- Customers
- Survey Collections
- Users
- Invitees
- Surveys
- Invitees (invitee is a child of both survey and user)
- Questions
- Etc
- Users
- Clients
I am unsure of the best implementation style. I like the django admin interface, but I would need clients to only be able to modify THEIR customers, surveysets etc, customers to only manage their own surveysets and so on.
Is there a way to implement this in Django, perhaps by doing customised user types via inheritance and assigning them custom Admin Sites?
I understand it may be easier to just make my own apps to manage the various 'admin' interfaces, in which case is there an easy way to manage separate authentication of these user types and their various admin-style management systems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最接近的是基于 如何在 Django 项目中有 2 个不同的管理站点? 并且与我问的另一个问题相关:django 中不同用户类型的单独“管理”界面
我最终创建了两个单独的 django admin 实例,每个实例都有自己的验证,该验证应用于模型上的过滤器和他们之间共享 CRUD 操作。
The closest I got to this was based on How to have 2 different admin sites in a Django project? and is related to another question I asked: seperate 'admin' interfaces for different user types in django
I ended up creating two seperate instances of django admin and each one had it's own validation which was applied to filters on models and CRUD actions shared between them.