Giter Club home page Giter Club logo

django-non-dark-admin's Introduction

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:

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.

django-non-dark-admin's People

Contributors

aemitos avatar doomer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

django-non-dark-admin's Issues

Error installing Package

I have Django 3.2.12 installed and when I try to install django-non-dark-admin via pip I get the following errors:
ERROR: Could not find a version that satisfies the requirement django-non-dark-admin (from versions: none)

ERROR: No matching distribution found for django-non-dark-admin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.