modeladmin 中代理模型的用户权限 [英] User permissions on proxy models in modeladmin

查看:11
本文介绍了modeladmin 中代理模型的用户权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用代理模型时:

class Uf(models.Model):
...

class CustomUf(Uf):
    class Meta:
        proxy = True

class CustomUfAdmin(admin.ModelAdmin)

admin.site.register(CustomUf, CustomUfAdmin)

似乎只有超级用户才能通过管理站点访问 CustomUf...我不知道如何将 CustomUf 的权限授予普通用户...

It seems like only superusers can access the CustomUf through admin site... I can't figure out how to grant permissions on CustomUf to regular users...

推荐答案

好的,Chris 关于内容类型的评论给了我提示...

Ok, Chris remark about content types gave me the hint...

我在admin.py"中定义代理对象时犯了一个错误.这样,您必须是超级管理员才能访问它.

I made the mistake to define the proxy object in "admin.py". This way, you have to be superadmin to access it.

如果我在models.py中定义了代理对象,那么内容类型就会出现并且一切正常...

If I define the proxy object in models.py, then the content type appears and everything works fine...

这篇关于modeladmin 中代理模型的用户权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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