django用户和组 - 在管理员中显示组成员资格? [英] django users and groups - show group membership in admin?

查看:186
本文介绍了django用户和组 - 在管理员中显示组成员资格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

django管理员的用户管理使我们能够轻松访问通过用于选择组的列表设置用户组的忠诚度。这是用于分配的ManyToMany关系默认小部件。而且大部分内容对于用户创建来说都是非常好的。

The django admin's User management gives us easy access to setting a User's group allegiances via the list for picking the Groups. This is the ManyToMany relationship default widget for assignment. And for the most part that's nice for User creation from the get go.

但是,说我有大量的用户和组...我想通过点击管理员中的组来查看和管理组成员的机会,并查看类似选择器中的所有成员(或通过横向小部件)。

However, say I have a huge number of users and groups...I'd like the chance to view and manage group membership by clicking on the Group in the admin and see all the members in a similar picker (or via the horizontal widget).

有没有内置的django方法/技巧来显示ManyToMany关系在反向?

Is there a builtin django method/trick to show ManyToMany relations in "reverse?"

设置组分配从用户创建的用户管理员中可以看出。但是,一旦用户和群体建立起来,这是一个很大的痛苦,找到和管理。

Setting group assignment is fine from the User adminform on User creation. But this is can be big pain to find and manage once users and groups are well established.

我想解决办法是让自己的观点来显示团队成员,我只是想看看是否有一些技巧可以用inline或某事在管理员

I guess the workaround is to make my own view to show group members, I just wanted to see if there was some trick I could do with inlines or something in the admin.

推荐答案

尝试使用这个片段。这是contrib.auth应用程序管理部分的定制示例。

Try to use this snippet. It's customisation example of contrib.auth app admin part.

这篇关于django用户和组 - 在管理员中显示组成员资格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆