Skip to main content

Really full Django read only admin implementation

Project description

Travis Coveralls Requires License Version Supported Python version Supported Django version Package format Python wheel support Package status

django-read-only-admin is a Django reusable application that fully implement read only admin

Installation

  • Obtain your copy of source code from the git repository: $ git clone https://github.com/vint21h/django-read-only-admin.git. Or download the latest release from https://github.com/vint21h/django-read-only-admin/tags/.
  • Run $ python ./setup.py install from the repository source tree or the unpacked archive. Or use pip: $ pip install django-read-only-admin.

Configuration

  • Add "read_only_admin" to settings.INSTALLED_APPS.
# settings.py

INSTALLED_APPS += [
    "read_only_admin",
]
  • Run $ python ./manage.py migrate.
  • Then add user/group change/delete/add/readonly model permissions.

Settings

READ_ONLY_ADMIN_PERMISSION_PREFIX
Read-only permission prefix. Defaults to: "readonly".
READ_ONLY_ADMIN_PERMISSION_NAME_PREFIX
Read-only permission name prefix. Defaults to: "Read only".
READ_ONLY_ADMIN_EMPTY_ACTIONS
Empty admin actions list (exclude superusers) or just remove delete selected action. Defaults to: True.

Usage

Just inherit your custom Django admin class from read_only_admin.admin.ReadonlyAdmin.

# admin.py

from read_only_admin.admin import ReadonlyAdmin


class MyCustomAdmin(ReadonlyAdmin):

    ...

Also tabular and stacked inlines are supported.

# admin.py

from read_only_admin.admin import (
    ReadonlyStackedInline,
    ReadonlyTabularInline,
)


class MyCustomTabularInline(ReadonlyTabularInline):

    model = MyModel  # type: Type[Model]
    extra = 0  # type: int


class MyCustomStackedInline(ReadonlyStackedInline):

    model = MyModel  # type: Type[Model]
    extra = 0  # type: int

If you use list_editable in your custom admin classes, copy read_only_admin/templates/admin/pagination.html to your project templates/admin directory.

Licensing

django-read-only-admin uses the MIT license. Please check the MIT-LICENSE file for more details.

Some part of code fairly stolen from teh internets with reference to the source. So, if you author of this code, please contact me.

Contacts

Project Website: https://github.com/vint21h/django-read-only-admin/

Author: Alexei Andrushievich <vint21h@vint21h.pp.ua>

For other authors list see AUTHORS file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-read-only-admin, version 0.12.1
Filename, size File type Python version Upload date Hashes
Filename, size django_read_only_admin-0.12.1-py3-none-any.whl (15.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-read-only-admin-0.12.1.zip (25.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page