Django Non Dark Admin
Disable or enable dark mode user interface in Django admin panel (Django==3.2).
Installation
For install this app run in terminal:
pip install django-non-dark-admin
Configuration for all users
Add ‘’django_non_dark_admin’’ to your INSTALLED_APPS settings. This is must be added BEFORE ‘’django.contrib.admin’’.
Set ‘’DISABLE_DARK_MODE = True’’ in your settings module to disable dark mode in admin panel user interface to all users.
Configuration per user
To have the theme configured as a user preference you will need to have a custom user model (model configured in settings.AUTH_USER_MODEL) as described in Django documentation:
https://docs.djangoproject.com/en/4.0/topics/auth/customizing/#substituting-a-custom-user-model
https://docs.djangoproject.com/en/4.0/ref/settings/#auth-user-model
Add a boolean field disable_dark_mode to your custom user model:
disable_dark_mode = models.BooleanField(
verbose_name="Django Admin Theme",
default=False choices=((False, "Dark"),
(True, "Light")),
null=True
)
After adding the field, run:
python manage.py makemigrations
It should generate a migration like this:
# Generated by Django 3.2.9 on 2021-12-27 19:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("app_for_the_auth_custom_model", "0XXX_previous_migration"),
]
operations = [
migrations.AddField(
model_name="<Your Custom Auth User model>",
name="disable_dark_mode",
field=models.BooleanField(
choices=[(False, "Dark"), (True, "Light")],
default=False,
null=True,
),
),
]
Run the migration:
python manage.py migrate
And the field will be added to your AUTH_USER_MODEL.
Go to the Django admin for your custom user model and add the field to be editable.
License
Licensed under BSD license. See license link in documentation.
Metadata
Release files for django-non-dark-admin 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-non-dark-admin-2.0.2.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_non_dark_admin-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / django-non-dark-admin-2.0.2.tar.gz
| Download URL | django-non-dark-admin-2.0.2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0c616a5d7be761ae118c569c96e554be5c6486f0e6d31d842e16f9b51be64ad
|
|
BLAKE2b-256 checksum How to use checksums |
39b35d1700fae38faf41986166c790a9eabc75b0661a5192000751419162d4f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.1 Linux/5.15.12-arch1-1
|
Release files / django_non_dark_admin-2.0.2-py3-none-any.whl
| Download URL | django_non_dark_admin-2.0.2-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89ed8e16d2a94304c9e9fe6d7a0ba38d08f9902d0d003e4c4ec28a682fb3df58
|
|
BLAKE2b-256 checksum How to use checksums |
1e40da71474b7aaafeb16a44c26358e10eee3d37890b8a01e3907feeb1d42b27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.1 Linux/5.15.12-arch1-1
|