简体   繁体   English

如何对Django管理面板启用自定义组

[英]How to enable a custom group to django admin panel

My question is very simple I created into the models.py a custom user model (it is called Staff) 我的问题很简单,我在模型中创建了一个自定义用户模型(称为Staff)

I would like to know how could i enable this user model called Staff to use the django admin panel In other words how can i add a Staff to a group created in the admin panel? 我想知道如何使名为Staff的用户模型使用django管理面板。换句话说,如何将Staff添加到在管理面板中创建的组中?

Thanks in advance 提前致谢

There's a is_staff flag for users. 用户有一个is_staff标志。 For your Staff class, just have 对于您的Staff班,

class Staff(User):
    is_staff = True
    ---Everything else---

Reference source django documentation 参考源Django文档

If you want to add staff permissions to users, simply click on the staff checkbox in the Admin interface. 如果要向用户添加人员权限,只需在管理界面中单击staff复选框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM