Visually distinguish environments in Django Admin

Overview

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"

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

ENVIRONMENT_FLOAT = True

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:

Issues
  • Dont work

    Dont work

    • django-admin-env-notice version:
    • Django version: 2.1
    • Python version: 3.7
    • Operating System: Ubuntu 18.04

    Dont work, I follow all the settings and do not modify the admin template.

    Body:before is not work

    bug can't reproduce 
    opened by fjbardelli 10
  • :rocket: added admin template selector override

    :rocket: added admin template selector override

    Basically we just need a setting to override the template selector so that when we have x,y,z admin theme setup we can hook it up however that theme works, in this case grappelli.

    opened by radyz 3
  • [feature] text color

    [feature] text color

    It would be cool to have a third variable for text color, so that using bright banners doesn't result in unreadable white-on-white.

    enhancement 
    opened by toyg 3
  • Scroll the environment label through the page

    Scroll the environment label through the page

    Make the environment label visible while the page is scrolled, to avoid mistakes when it's not visible.

    opened by jmorenoamor 3
  • Compatibility using Django Grappelli

    Compatibility using Django Grappelli

    • django-admin-env-notice version: 0.1.1
    • Django version: 1.11.2
    • Python version: 3.6
    • Operating System: Linux

    Description

    I am trying to setup django admin env notice using django grappelli

    What I Did

    I installed the package and I got the following:

    Everything looks good image

    But when I scroll down I see a space in the top because the position of the header in grappelli is fixed image

    Would be great to have compatibility with grappelli. Regards.

    opened by Xepe 2
  • Added block super to base_site.html and bumped up version micro num.

    Added block super to base_site.html and bumped up version micro num.

    I added a block super because our admin custom header was being overwritten.

    opened by richardtemple29 2
  • Incorrect syntax (closing condition)

    Incorrect syntax (closing condition)

    https://github.com/dizballanze/django-admin-env-notice/blob/0e46f41f93c07f23cad7a4a6a022e0f77f506278/django_admin_env_notice/templates/admin/base_site.html#L16

    Incorrect wrapping/closing. Lines 16 and 17 should be switched.

    opened by eriktelepovsky 1
  • Add a nonce attribute if django-csp is in use

    Add a nonce attribute if django-csp is in use

    Should fix #9

    opened by heg-ulmuten 1
  • Make text color configurable

    Make text color configurable

    Should fix #7

    opened by heg-ulmuten 1
Owner
Yuri Shikanov
Software developer
Yuri Shikanov
Jet Bridge (Universal) for Jet Admin – API-based Admin Panel Framework for your application

Jet Bridge for Jet Admin – Admin panel framework for your application Description About Jet Admin: https://about.jetadmin.io Live Demo: https://app.je

Jet Admin 1.1k Nov 25, 2021
aiohttp admin is generator for admin interface based on aiohttp

aiohttp admin is generator for admin interface based on aiohttp

Mykhailo Havelia 8 Nov 24, 2021
📱 An extension for Django admin that makes interface mobile-friendly. Merged into Django 2.0

Django Flat Responsive django-flat-responsive is included as part of Django from version 2.0! ?? Use this app if your project is powered by an older D

elky 249 Nov 12, 2021
An improved django-admin-tools dashboard for Django projects

django-fluent-dashboard The fluent_dashboard module offers a custom admin dashboard, built on top of django-admin-tools (docs). The django-admin-tools

django-fluent 301 Nov 30, 2021
A Django app for easily adding object tools in the Django admin

Django Object Actions If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?"

Chris Chang 415 Nov 25, 2021
Disable dark mode in Django admin user interface in Django 3.2.x.

Django Non Dark Admin Disable or enable dark mode user interface in Django admin panel (Django==3.2). Installation For install this app run in termina

Artem Galichkin 1 Oct 23, 2021
Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo

Django JET Modern template for Django admin interface with improved functionality Attention! NEW JET We are proud to announce completely new Jet. Plea

Geex Arts 3.2k Dec 1, 2021
Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.

Xadmin Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap. Liv

差沙 4.6k Nov 24, 2021
A jazzy skin for the Django Admin-Interface (official repository).

Django Grappelli A jazzy skin for the Django admin interface. Grappelli is a grid-based alternative/extension to the Django administration interface.

Patrick Kranzlmueller 3.1k Nov 25, 2021
A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps.

django-admin-bootstrapped A Django admin theme using Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed ap

null 1.6k Nov 18, 2021
django's default admin interface made customizable. popup windows replaced by modals. :mage: :zap:

django-admin-interface django-admin-interface is a modern responsive flat admin interface customizable by the admin itself. Features Beautiful default

Fabio Caccamo 976 Dec 1, 2021
Extendable, adaptable rewrite of django.contrib.admin

django-admin2 One of the most useful parts of django.contrib.admin is the ability to configure various views that touch and alter data. django-admin2

Jazzband 1.1k Nov 26, 2021
Modern theme for Django admin interface

Django Suit Modern theme for Django admin interface. Django Suit is alternative theme/skin/extension for Django administration interface. Project home

Kaspars Sprogis 2.1k Nov 22, 2021
Django application and library for importing and exporting data with admin integration.

django-import-export django-import-export is a Django application and library for importing and exporting data with included admin integration. Featur

null 2.3k Dec 1, 2021
:honey_pot: A fake Django admin login screen page.

django-admin-honeypot django-admin-honeypot is a fake Django admin login screen to log and notify admins of attempted unauthorized access. This app wa

Derek Payton 819 Nov 25, 2021
"Log in as user" for the Django admin.

django-loginas About "Login as user" for the Django admin. loginas supports Python 3 only, as of version 0.4. If you're on 2, use 0.3.6. Installing dj

Stavros Korokithakis 290 Nov 22, 2021
A new style for Django admin

Djamin Djamin a new and clean styles for Django admin based in Google projects styles. Quick start Install djamin: pip install -e git://github.com/her

Herson Leite 234 Oct 20, 2021
Responsive Theme for Django Admin With Sidebar Menu

Responsive Django Admin If you're looking for a version compatible with Django 1.8 just install 0.3.7.1. Features Responsive Sidebar Menu Easy install

Douglas Miranda 812 Nov 18, 2021
A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps.

django-admin-bootstrapped A Django admin theme using Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed ap

null 1.6k Nov 18, 2021