Visually distinguish environments in Django Admin
Project description
============================= django-admin-env-notice
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
:
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"
Optionally, set the environment banner to float over instead of being fixed to the top:
ENVIRONMENT_FLOAT = True
Screenshots
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Credits
Tools used in rendering this package:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-admin-env-notice-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 057dd158a5e20a0937a4383c30b222eaef459c8d04a52fc4729cbedc3b7a7567 |
|
MD5 | 31aefeacd9bd6490332ca8d5394f5053 |
|
BLAKE2b-256 | 0ae4d756edec54aab02bc7165a6da0c362ecb024e591fa782bd2531fce32366d |
Hashes for django_admin_env_notice-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1604343c664fc937064aa5b5daf868ecbc9802b4bec86318b9ace539abe26ef8 |
|
MD5 | 20da024bdc0f2f2854e9988b33bdd9c4 |
|
BLAKE2b-256 | 7fe54b6c1a961012a15bb2839d53b9515885c971db3f5eae843c25c146cb26b8 |