Py学习  »  Django

救急:请问大家怎么在adjango amdin 权限控制中添加只读权限

昨夜星辰 • 11 年前 • 5599 次点击  

如题: 只读权限定义只能查看 model 不允许修改model.

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/450
 
5599 次点击  
文章 [ 1 ]  |  最新文章 11 年前
Py站长
Reply   •   1 楼
Py站长    11 年前

http://stackoverflow.com/questions/17118320/how-to-add-readonly-inline-on-django-admin

After a while of trying to find the name I figured out thanks to this answer, so I checked the names at self.opts.local_fields and found the name of the middle table and added it to a readonly field:

class SummaryInline(admin.TabularInline):
    model = ParserError.summaries.through
    readonly_fields = ('myclasssummary',)

pretty simple but took me a while so I figured out it was a good idea to add it here.

这个是否是你想要问的?