Giter VIP home page Giter VIP logo

django-admin-env-notice's Introduction

django-admin-env-notice

Package Version Build Status Code Coverage

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"

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

ENVIRONMENT_FLOAT = True

You can also set the text color (default: white) by setting:

ENVIRONMENT_TEXT_COLOR = "#00FF00"

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:

django-admin-env-notice's People

Contributors

dizballanze avatar heg-ulmuten avatar jmorenoamor avatar radyz avatar richardtemple29 avatar vint21h avatar xepe avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.