Skip to content

Commit

Permalink
Update django and add banner with env name (#2474)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoacierno authored Nov 16, 2021
1 parent ff182dd commit 33ce403
Show file tree
Hide file tree
Showing 10 changed files with 472 additions and 179 deletions.
Empty file.
6 changes: 6 additions & 0 deletions backend/custom_admin/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin

SITE_NAME = "PyCon Italy"

admin.site.site_header = SITE_NAME
admin.site.site_title = SITE_NAME
5 changes: 5 additions & 0 deletions backend/custom_admin/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.conf import settings


def admin_settings(request):
return {"CURRENT_ENV": settings.ENV}
Empty file.
Empty file.
131 changes: 131 additions & 0 deletions backend/custom_admin/templates/admin/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{% extends 'admin/base.html' %}

{% block extrastyle %}{{ block.super }}
<style>
@media (prefers-color-scheme: dark) {
:root {
--primary: #79aec8;
--secondary: #417690;
--accent: #f5dd5d;
--primary-fg: #fff;

--body-fg: #333;
--body-bg: #fff;
--body-quiet-color: #666;
--body-loud-color: #000;

--header-color: #ffc;
--header-branding-color: var(--accent);
--header-bg: var(--secondary);
--header-link-color: var(--primary-fg);

--breadcrumbs-fg: #c4dce8;
--breadcrumbs-link-fg: var(--body-bg);
--breadcrumbs-bg: var(--primary);

--link-fg: #447e9b;
--link-hover-color: #036;
--link-selected-fg: #5b80b2;

--hairline-color: #e8e8e8;
--border-color: #ccc;

--error-fg: #ba2121;

--message-success-bg: #dfd;
--message-warning-bg: #ffc;
--message-error-bg: #ffefef;

--darkened-bg: #f8f8f8;
/* A bit darker than --body-bg */
--selected-bg: #e4e4e4;
/* E.g. selected table cells */
--selected-row: #ffc;

--button-fg: #fff;
--button-bg: var(--primary);
--button-hover-bg: #609ab6;
--default-button-bg: var(--secondary);
--default-button-hover-bg: #205067;
--close-button-bg: #888;
/* Previously #bbb, contrast 1.92 */
--close-button-hover-bg: #747474;
--delete-button-bg: #ba2121;
--delete-button-hover-bg: #a41515;

--object-tools-fg: var(--button-fg);
--object-tools-bg: var(--close-button-bg);
--object-tools-hover-bg: var(--close-button-hover-bg);
}
}

@media (prefers-color-scheme: light) {
:root {
--primary: #79aec8;
--secondary: #417690;
--accent: #f5dd5d;
--primary-fg: #fff;

--body-fg: #333;
--body-bg: #fff;
--body-quiet-color: #666;
--body-loud-color: #000;

--header-color: #ffc;
--header-branding-color: var(--accent);
--header-bg: var(--secondary);
--header-link-color: var(--primary-fg);

--breadcrumbs-fg: #c4dce8;
--breadcrumbs-link-fg: var(--body-bg);
--breadcrumbs-bg: var(--primary);

--link-fg: #447e9b;
--link-hover-color: #036;
--link-selected-fg: #5b80b2;

--hairline-color: #e8e8e8;
--border-color: #ccc;

--error-fg: #ba2121;

--message-success-bg: #dfd;
--message-warning-bg: #ffc;
--message-error-bg: #ffefef;

--darkened-bg: #f8f8f8;
/* A bit darker than --body-bg */
--selected-bg: #e4e4e4;
/* E.g. selected table cells */
--selected-row: #ffc;

--button-fg: #fff;
--button-bg: var(--primary);
--button-hover-bg: #609ab6;
--default-button-bg: var(--secondary);
--default-button-hover-bg: #205067;
--close-button-bg: #888;
/* Previously #bbb, contrast 1.92 */
--close-button-hover-bg: #747474;
--delete-button-bg: #ba2121;
--delete-button-hover-bg: #a41515;

--object-tools-fg: var(--button-fg);
--object-tools-bg: var(--close-button-bg);
--object-tools-hover-bg: var(--close-button-hover-bg);
}
}

#header {
margin-top: 40px;
}
</style>
{% endblock extrastyle %}

{% block userlinks %}
<div
style="position: fixed; z-index: 100; top: 0; left: 0; right: 0; background-color: #417690; text-align: center; padding: 15px 30px;">
{{CURRENT_ENV}} environment
</div>
{{ block.super }}
{% endblock %}
Loading

0 comments on commit 33ce403

Please sign in to comment.