社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Django

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

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

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

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/450
 
5611 次点击  
文章 [ 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.

这个是否是你想要问的?