Force disable permissions in admin site.
Project description
django-force-disable-permissions-admin
Force disable permissions in admin site.
Install
pip install django-force-disable-permissions-admin
Usage
pro/settings.py
INSTALLED_APPS = [
...
'force_disable_permissions',
...
]
app/admin.py
from django.contrib import admin
from .models import Category
from .models import Book
from force_disable_permissions.admin import ForceDisablePermissionsAdminMixin
class BookInline(admin.TabularInline):
model = Book
class CategoryAdmin(ForceDisablePermissionsAdminMixin, admin.ModelAdmin):
delete_permission_enable_for_superuser = True
view_permission_enable_for_superuser = True
force_disable_delete_permission = True
force_disable_change_permission = True
list_display = ["name"]
inlines = [
BookInline,
]
admin.site.register(Category, CategoryAdmin)
Control Variables
- add_permission_enable_for_superuser = False
- delete_permission_enable_for_superuser = False
- change_permission_enable_for_superuser = False
- view_permission_enable_for_superuser = False
- force_disable_add_permission = False
- force_disable_delete_permission = False
- force_disable_change_permission = False
- force_disable_view_permission = False
Note:
- By default, ForceDisablePermissionsAdminMixin doesn't change anything.
- Use the control-variabl to disable permissions.
Releases
v0.1.1 2020.02.05
- Fix usage document.
v0.1.0 2020.02.05
- First release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-force-disable-permissions-admin-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31e367db99c4477b4ba71bcbb9c4190315c304386c6f54cfa02bd5c76a97958f |
|
MD5 | 28f92cb2662cb1de6fe01d2df6ac69f5 |
|
BLAKE2b-256 | 4a3f2eaecffc0c6651ac0b94751616e087737903249397e7d8b043c841e32e2d |