Skip to main content

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 = [
    ...
    'django_force_disable_permissions_admin',
    ...
]

app/admin.py

from django.contrib import admin
from .models import Category
from .models import Book
from django_force_disable_permissions_admin.admin import DjagnoForceDisablePermissionsAdminMixin

class BookInline(admin.TabularInline):
    model = Book

class CategoryAdmin(DjagnoForceDisablePermissionsAdminMixin, admin.ModelAdmin):
    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 = True
    force_disable_delete_permission = True
    force_disable_change_permission = True
    force_disable_view_permission = False

    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, DjagnoForceDisablePermissionsAdminMixin doesn't change anything.
  • Use the control-variabl to disable permissions.

Releases

v0.2.0 2020.02.26

  • App rename to django_force_disable_permissions_admin.

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

File details

Details for the file django-force-disable-permissions-admin-0.2.0.tar.gz.

File metadata

  • Download URL: django-force-disable-permissions-admin-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for django-force-disable-permissions-admin-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a226c5e9d58cbb0cfd679baaff544828e0c9a266021a5f919d6b6e27fd5ab7ce
MD5 2aaf5baaabf728fd926acf5eb7980ac1
BLAKE2b-256 664fb64590f565267258084be2bbfc26f5decd0f90b8c5977780631c59557e74

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page