No project description provided
Project description
Garpix Admin lock
Garpix Admin lock allows you to lock a page in the admin panel
Quickstart
Install with pip:
pip install garpix_admin_lock
Add the garpix_admin_lock
and dependency packages to your INSTALLED_APPS
:
# settings.py
INSTALLED_APPS = [
# ...
'garpix_admin_lock',
# ...
]
Package not included migrations, set path to migration directory. Don't forget create this directory (app/migrations/garpix_admin_lock/
) and place empty __init__.py
:
app/migrations/
app/migrations/__init__.py # empty file
app/migrations/garpix_admin_lock/__init__.py # empty file
Add path to settings:
# settings.py
MIGRATION_MODULES = {
'garpix_admin_lock': 'app.migrations.garpix_admin_lock',
}
Add url to urls.py
# url.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('page_lock/', include('garpix_admin_lock.urls')),
]
Run make migrations:
python manage.py makemigrations
Migrate:
python manage.py migrate
Example
Add PageLockViewMixin
in models
# example/models.py
from django.db import models
from admin_page_lock.mixins import PageLockViewMixin
class ExampleLock(PageLockViewMixin, models.Model):
...
Add PageLockAdminMixin
in admin
# example/admin.py
from admin_page_lock.mixins import PageLockAdminMixin
from django.contrib import admin
from .models import Example
@admin.register(ExampleLock)
class ExampleAdmin(PageLockAdminMixin, admin.ModelAdmin):
lock_change_view = True
lock_changelist_view = False
...
Basis
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
garpix_admin_lock-1.1.1.tar.gz
(26.3 kB
view hashes)
Built Distribution
Close
Hashes for garpix_admin_lock-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a50f6433e8268daa8affe77883b092318546371b61ce5f5d2f8b6c4d82dda3bb |
|
MD5 | 94bf116b14a2229b1ae0a02a7d5170e9 |
|
BLAKE2b-256 | b10b31db634307afa04f15804d58963221f0d23bdd3428c5a96b6708473c524d |