-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💄(admin) allow header color customization
This allows to use custom colors according to environment. FIXES #430
- Loading branch information
Showing
8 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""People custom admin site.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Custom Django admin site application configuration.""" | ||
|
||
from django.contrib.admin.apps import AdminConfig | ||
|
||
|
||
class PeopleAdminConfig(AdminConfig): | ||
"""Declare our custom Django admin site.""" | ||
|
||
default_site = "admin.sites.PeopleAdminSite" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Custom Django admin site for the People app.""" | ||
|
||
from django.conf import settings | ||
from django.contrib import admin | ||
|
||
|
||
class PeopleAdminSite(admin.AdminSite): | ||
"""People custom admin site.""" | ||
|
||
def each_context(self, request): | ||
"""Add custom context to the admin site.""" | ||
return super().each_context(request) | { | ||
"ADMIN_HEADER_BACKGROUND": settings.ADMIN_HEADER_BACKGROUND, | ||
"ADMIN_HEADER_COLOR": settings.ADMIN_HEADER_COLOR, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{% extends "admin/base_site.html" %} | ||
|
||
{% block extrastyle %}{{ block.super }} | ||
<style> | ||
html[data-theme="light"], :root { | ||
{% if ADMIN_HEADER_BACKGROUND %}--header-bg: {{ ADMIN_HEADER_BACKGROUND }};{% endif %} | ||
{% if ADMIN_HEADER_COLOR %}--header-color: {{ ADMIN_HEADER_COLOR }};{% endif %} | ||
} | ||
</style> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters