From 5d09c07866f0646a261499fa616481cec8786228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com> Date: Fri, 8 Apr 2022 00:48:28 +0200 Subject: [PATCH] tuning: Colorize dev and test env admin --- tuning/wagtail_hooks.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tuning/wagtail_hooks.py b/tuning/wagtail_hooks.py index 8f148360..870f141b 100644 --- a/tuning/wagtail_hooks.py +++ b/tuning/wagtail_hooks.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.contrib.postgres.lookups import Unaccent from django.db.models.functions import Lower from django.utils.safestring import mark_safe @@ -27,3 +28,16 @@ def add_another_welcome_panel(request, panels): @hooks.register("construct_explorer_page_queryset") def show_my_profile_only(parent_page, pages, request): return pages.order_by(Unaccent(Lower("title"))) + + +@hooks.register("insert_global_admin_css") +def global_admin_css(): + if settings.MAJAK_ENV == "test": + return mark_safe( + '<style type="text/css">.sidebar__inner { background-color: #00203A }</style>' + ) + if settings.MAJAK_ENV == "dev": + return mark_safe( + '<style type="text/css">.sidebar__inner { background-color: #002A20 }</style>' + ) + return "" -- GitLab