Remove (or hide) default Permissions from Django

前端 未结 8 1195
醉酒成梦
醉酒成梦 2021-01-30 17:53

I\'m developing a Django app that will have two administration backends. One for daily use by \"normal\" users and the default one for more advanced tasks and for the developers

8条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 18:36

    ShadowCloud gave a good rundown. Here's a simple way to accomplish your goal.

    Add these line in your admin.py:

    from django.contrib.auth.models import Permission
    admin.site.register(Permission)
    

    You can now add/change/delete permissions in the admin. Remove the unused ones and when you have what you want, go back and remove these two lines from admin.py.

    As was mentioned by others, a subsequent syncdb will put everything back.

提交回复
热议问题