A Django app make the admin public
Project description
django-public-admin-mixins
WARNING: Using this app may introduce security issues. We don't recommend using it in production. Use at you own risk.
This app helps developers create public interfaces using the django admin. That is, an interface where no login is required, and all users only have view permission on models.
There is another app,
django-public-admin,
which implements a similar funcionality, but uses child classes instead
of mixins. For small admin projects it should be quicker to setup, but
these mixins allow for more configurability.
Installation
$ pip install django-public-admin-mixins- Add
public_adminto youINSTALLED_APPS, beforedjango.contrib.admin
Usage
To make the admin interface public, one must configure both the admin
site and the ModelAdmin classes that are registered to that site. For
that, django-public-admin-mixins exposes two mixins:
PublicAdminSiteMixin and PulbicModelAdminMixin. To use the former,
one must use a custom admin site. More details can be found
here,
but the basic idea for overriding the default admin site is as follows:
# myproject/admin.py
from django.contrib import admin
from django_public_admin.admin import PublicAdminSiteMixin
class PublicAdminSite(PublicAdminSiteMixin, admin.AdminSite):
pass
# myproject/apps.py
from django.contrib.admin.apps import AdminConfig
class PublicAdminConfig(AdminConfig):
default_site = "myproject.admin.PublicAdminSite"
# myproject/settings.py
INSTALLED_APPS = [
# ...
"myproject.apps.PublicAdminConfig", # replaces 'django.contrib.admin'
# ...
]
When registering a model to this admin site, use a custom model admin which uses our mixin:
# myapp/admin.py
from django.contrib import admin
from django_public_admin.admin import PublicModelAdminMixin
from .models import MyModel
class PublicModelAdmin(PublicModelAdminMixin, admin.ModelAdmin):
pass
admin.site.register(MyModel, PublicModelAdmin)
Templates
This app ships with templates to override links in the head of the site
that aren't suited to a public admin, like the ones for login and
logout. If you decide to use your own, there is no need to add the app
to the INSTALLED_APPS list.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_public_admin_mixins-0.0.1.tar.gz.
File metadata
- Download URL: django_public_admin_mixins-0.0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01bd25837cc86770455e3f093f71aae233f003765d536be6ab9cdaaaa40615c4
|
|
| MD5 |
439d147d8f35a131266519c159512e5a
|
|
| BLAKE2b-256 |
73b8fdddcc59a0e731ac743757bd3f9c78d9cad4ebfce80b72009c87b0367789
|
File details
Details for the file django_public_admin_mixins-0.0.1-py3-none-any.whl.
File metadata
- Download URL: django_public_admin_mixins-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e366bb4ac9ec1b29750bb8e23fde20706977a0869db207ebfa9435f76ee013
|
|
| MD5 |
3ee0217d2d4222b48d58b24818cb0e6b
|
|
| BLAKE2b-256 |
ff00ccdc62dc8c54f8c387953ef0a018db13af2864f50bb2eb14528cb4497f57
|