Visually distinguish environments in Django Admin
Project description
============================= 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, se 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
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
File details
Details for the file django-admin-env-notice-0.2.tar.gz
.
File metadata
- Download URL: django-admin-env-notice-0.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53fb237b8655ed72b401caf08d1bf13035c0e989899eaa36ef92ff2976e83a7b |
|
MD5 | 3ad2cdfbc0e8a66f7b20687532bb3e17 |
|
BLAKE2b-256 | 1be39745399a0d3222a1c97e9a06415fca0c5ca214cb80082d59eed96b7c66ff |
File details
Details for the file django_admin_env_notice-0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: django_admin_env_notice-0.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3897c4b06f0d579ca3aab8024e4291d6bb2bc41f283211136b4e30062c5a0355 |
|
MD5 | ce4b18d771d2d8b5ab68d0b5506c55a0 |
|
BLAKE2b-256 | 09f229295711229c40588d22abfcf6a19145af83f0fd3ec494163f2d3be5863b |