Skip to main content

============================= django-admin-env-notice

.. image:: https://badge.fury.io/py/django-admin-env-notice.svg :target: https://badge.fury.io/py/django-admin-env-notice

.. image:: https://travis-ci.org/dizballanze/django-admin-env-notice.svg?branch=master :target: https://travis-ci.org/dizballanze/django-admin-env-notice

.. image:: https://codecov.io/gh/dizballanze/django-admin-env-notice/branch/master/graph/badge.svg :target: https://codecov.io/gh/dizballanze/django-admin-env-notice

.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg :target: https://saythanks.io/to/dizballanze

Visually distinguish environments in Django Admin. Based on great advice from post: 5 ways to make Django Admin safer <https://hackernoon.com/5-ways-to-make-django-admin-safer-eb7753698ac8>_ by hakibenita <https://hackernoon.com/@hakibenita>_.

Requirements

  • Python 2.7, 3.4+
  • Django 1.9+

Quickstart

Install django-admin-env-notice::

pip install django-admin-env-notice

Add it to your INSTALLED_APPS before django.contrib.admin:

.. code-block:: python

INSTALLED_APPS = (
    ...
    'django_admin_env_notice',
    'django.contrib.admin',
    ...
)

Add context processor:

.. code-block:: python

TEMPLATES = [
    {
        ...
        "OPTIONS": {
            "context_processors": [
                ...
                "django_admin_env_notice.context_processors.from_settings",
            ],
        },
    },
]

Set label and color for current environment:

.. code-block:: python

ENVIRONMENT_NAME = "Production server"
ENVIRONMENT_COLOR = "#FF2222"

Override django admin selector if necessary (default: body), e.g: grappelli:

.. code-block:: python

ENVIRONMENT_ADMIN_SELECTOR = "grp-header"

Optionally, set the environment banner to float over instead of being fixed to the top:

.. code-block:: python

ENVIRONMENT_FLOAT = True

Screenshots

.. image:: ./screenshots/prod.png .. image:: ./screenshots/dev.png .. image:: ./screenshots/testing.png

Running Tests

Does the code actually work?

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

  • Cookiecutter_
  • cookiecutter-djangopackage_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter-djangopackage: https://github.com/pydanny/cookiecutter-djangopackage

Metadata

Release files for django-admin-env-notice 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-env-notice 0.3
File Size Uploaded
django-admin-env-notice-0.3.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-env-notice 0.3
File Interpreter ABI Platform
django_admin_env_notice-0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.2 kB

Release files / django-admin-env-notice-0.3.tar.gz

Download URL django-admin-env-notice-0.3.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
063f6c41255263ca02a86e2bbf0ed968f81e958012361f4a5d25a13bb2e551e3
BLAKE2b-256 checksum
How to use checksums
20cee6266b6d8fca3cad489f94792e46d01ee251d46b2452e793aa40cdc12f96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

Release files / django_admin_env_notice-0.3-py2.py3-none-any.whl

Download URL django_admin_env_notice-0.3-py2.py3-none-any.whl
Size 5.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e34e7090b5f331155e148b085f694dc985b96477bb5602d556ae4427ebf650a6
BLAKE2b-256 checksum
How to use checksums
c9c90c9cca038c951f1e899f76af2302fad8cffbcaf6dd9975ed7c9860ae1519
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

Release history Release notifications | RSS feed

1.0.1

2 release files

1.0

2 release files

0.4

2 release files

0.3.1

2 release files

This release

0.3 This release

2 release files

0.2

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page