Visually distinguish environments in Django Admin
Python Makefile HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
django_admin_env_notice Merge branch 'master' of github.com:dizballanze/django-admin-env-notice Nov 6, 2017
screenshots πŸ“ add screenshots to readme Jun 20, 2017
tests βœ… added test code for admin template selector override Jun 29, 2017
.coveragerc πŸ”§ omit apps.py in coverage report Jun 20, 2017
.editorconfig πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
.gitignore πŸ”§ ignore .DS_Store files Jun 20, 2017
.travis.yml πŸ”§ remove django1.8 from travis ci config Jun 20, 2017
AUTHORS.rst πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
LICENSE πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
MANIFEST.in πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
Makefile πŸ‘” fix linter warnings Jun 20, 2017
README.rst πŸ“ add thank you button Jul 26, 2018
manage.py πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
requirements.txt πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
requirements_dev.txt πŸš€ add functionality and tests Jun 20, 2017
requirements_test.txt πŸ”§ Python 2 compatibility Jun 20, 2017
runtests.py πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
setup.cfg πŸš€ initial project template with `cookiecutter-djangopackage` Jun 20, 2017
setup.py [EDU-7970] - Setup/config for new package. Jul 6, 2017
tox.ini πŸ”§ Python 2 compatibility Jun 20, 2017

README.rst

django-admin-env-notice

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

Visually distinguish environments in Django Admin. Based on great advice from post: 5 ways to make Django Admin safer by 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:

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

Add context processor:

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

Set label and color for current environment:

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

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

ENVIRONMENT_ADMIN_SELECTOR = "grp-header"

Screenshots

./screenshots/prod.png

./screenshots/dev.png

./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: