Skip to main content

Show a floating notice banner above the Django admon interface

Project description

Django Admin Notice

PyPI PyPI - Python Version PyPI - Django Version Downloads Codecov License

Show a floating notice banner above the Django admin interface. Particularly useful for indicating the current deployment environment.

Admin notice preview (light mode) Admin notice preview (dark mode)


Install django-admin-notice by running pip install django-admin-notice

Add admin_notice to your INSTALLED_APPS somewhere before django.contrib.admin.

    "admin_notice",  # <-- Add this somewhere before "django.contrib.admin"
    # ... other apps

Add admin_notice.context_processors.notice to the templates context_processors. Having django.template.context_processors.request is required as well.

        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.request",  # <-- have this
                "admin_notice.context_processors.notice",  # <-- Add this
                # ... other context processors


Set the ADMIN_NOTICE_TEXT to the text you want to show above the admin interface. No message is shown if this setting is missing or empty.

ADMIN_NOTICE_TEXT = "Production environment"

Optionally specify a custom text color and background for your notice. The default text color is white and the default background red.


Furthermore, optional dark theme color variants can be specified. The dark theme colors default to the non-dark theme colors.



It's a common use case to indicate the projects deployment environment. The following configuration shows how to obtain the django-admin-notice configuration from environment variables and how to configure a fallback.

from os import environ

ADMIN_NOTICE_TEXT = environ.get("ADMIN_NOTICE_TEXT", "Local environment")

Example project

Take a look at our Django example project under tests/project. You can run it by executing these commands:

  1. poetry install
  2. poetry run python tests/project/ migrate
  3. poetry run python tests/project/ createsuperuser
  4. poetry run python tests/project/ runserver

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_notice-3.0.1.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

django_admin_notice-3.0.1-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page