xadmin icon indicating copy to clipboard operation
xadmin copied to clipboard

字段权限

Open younglicode opened this issue 8 years ago • 4 comments

def get_fields(self, request, obj=None): if request.user.is_superuser or request.user.has_perm('myapp.view_secret'): return ['name', 'age', 'secret'] return ['name', 'age']

admin 通过这个方法,可以设置字段谁可以看,xadmin怎么弄?

younglicode avatar Jul 12 '17 02:07 younglicode

我是通过修改 list_display 来做的。

wgbbiao avatar Jul 16 '17 09:07 wgbbiao

我是通过修改 list_display 来做的。

没明白,可否给举例一下,谢谢!

因为我理解 list_display 是用来确定 change list page 显示哪些列的。这个在 xadmin 里也能像 django admin get_fields 来限制字段吗?

wangzhaohe avatar May 19 '18 06:05 wangzhaohe

@younglicode

请问您解决这个问题了吗?

wangzhaohe avatar May 19 '18 12:05 wangzhaohe