django admin 增加查看权限

django2.1以下是没有view权限的,所有可能有需要增加view权限的需求,最简单的方法,用现成的轮子django-admin-view-permission

直接三步走:

1、安装django-admin-view-permission

pip install django-admin-view-permission

2、django配置中INSTALLED_APPS添加admin_view_permission

INSTALLED_APPS = [
    'admin_view_permission',
    # ...
    'django.contrib.admin',
    # ...
]

3、迁移到数据库:

python manage.py migrate

 

参考:https://stackoverflow.com/questions/3068843/permission-to-view-but-not-to-change-django/49132957#49132957

文档:https://django-admin-view-permission.readthedocs.io/en/latest/installation.html

django view:https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.has_view_permission

你可能感兴趣的:(django admin 增加查看权限)