django-read-only-admin is a Django reusable application that fully implement read only admin
- 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 installfrom the repository source tree or the unpacked archive. Or use pip:$ pip install django-read-only-admin.
- Add "read_only_admin"tosettings.INSTALLED_APPS.
# settings.py
INSTALLED_APPS += [
    "read_only_admin",
]- Run $ python ./manage.py migrate.
- Then add user/groupchange/delete/add/readonlymodel permissions.
- 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.
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: Type[Model] = MyModel
    extra: int = 0
class MyCustomStackedInline(ReadonlyStackedInline):
    model: Type[Model] = MyModel
    extra: int = 0If you use list_editable in your custom admin classes, copy read_only_admin/templates/admin/pagination.html to your project templates/admin directory.
- Fork it
- Install GNU Make
- Install and configure pyenv and pyenv-virtualenv plugin
- Install and configure direnv
- Create environment config from example
cp .env.example .env- Install development dependencies:
make install- Create your fix/feature branch:
git checkout -b my-new-fix-or-feature- Check code style and moreover:
make check- Run tests:
make test- Push to the branch:
git push origin my-new-fix-or-featuredjango-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.
Project Website: https://github.com/vint21h/django-read-only-admin/
Author: Alexei Andrushievich <[email protected]>
For other authors list see AUTHORS file.