modeladmin中代理模型的用户权限 [英] User permissions on proxy models in modeladmin
本文介绍了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...
推荐答案
关于内容类型给了我提示...
Ok, Chris remark about content types gave me the hint...
我错误地在admin.py中定义了代理对象。这样,你必须是superadmin才能访问它。
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屋!
查看全文