Metadata-Version: 2.1
Name: django-non-dark-admin
Version: 2.0.1
Summary: Disable dark mode in Django admin user interface in Django 3.2.x.
Home-page: https://github.com/DOOMer/django-non-dark-admin
License: BSD
Keywords: django,admin,dark,fix
Author: Artem Galichkin
Author-email: doomer3d@gmail.com
Maintainer: Artem Galichkin
Maintainer-email: doomer3d@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: License :: OSI Approved :: BSD License
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: django (>=3.2)
Project-URL: Bug Tracker, https://github.com/DOOMer/django-non-dark-admin/issues
Project-URL: Repository, https://github.com/DOOMer/django-non-dark-admin
Description-Content-Type: text/x-rst

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:

.. code-block:: python

    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:

.. code-block:: python

    # 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.

.. _license link: LICENSE.rst
