mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 14:54:22 +00:00
✨ Customize (more) the admin page
This commit is contained in:
parent
98014204bc
commit
7074b3f921
6 changed files with 93 additions and 6 deletions
|
@ -27,6 +27,7 @@
|
||||||
<env name="DJANGO_DOCKER_TLS_VERIFY" value="" />
|
<env name="DJANGO_DOCKER_TLS_VERIFY" value="" />
|
||||||
<env name="DJANGO_DOCKER_CERT_PATH" value="" />
|
<env name="DJANGO_DOCKER_CERT_PATH" value="" />
|
||||||
<env name="DJANGO_SETTINGS_MODULE" value="sophon.settings" />
|
<env name="DJANGO_SETTINGS_MODULE" value="sophon.settings" />
|
||||||
|
<env name="DJANGO_SECRET_KEY" value="development" />
|
||||||
</envs>
|
</envs>
|
||||||
<option name="SDK_HOME" value="$USER_HOME$/.cache/pypoetry/virtualenvs/sophon-rpVYiJ6v-py3.9/bin/python" />
|
<option name="SDK_HOME" value="$USER_HOME$/.cache/pypoetry/virtualenvs/sophon-rpVYiJ6v-py3.9/bin/python" />
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
|
|
@ -23,5 +23,10 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="TemplatesService">
|
<component name="TemplatesService">
|
||||||
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
<option name="TEMPLATE_CONFIGURATION" value="Django" />
|
||||||
|
<option name="TEMPLATE_FOLDERS">
|
||||||
|
<list>
|
||||||
|
<option value="$MODULE_DIR$/sophon/templates" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
20
backend/sophon/admin.py
Normal file
20
backend/sophon/admin.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import django.contrib.admin.apps
|
||||||
|
|
||||||
|
|
||||||
|
class SophonAdminConfig(django.contrib.admin.apps.AdminConfig):
|
||||||
|
"""
|
||||||
|
Customized administration site config.
|
||||||
|
"""
|
||||||
|
default_site = "sophon.admin.SophonAdminSite"
|
||||||
|
|
||||||
|
|
||||||
|
class SophonAdminSite(django.contrib.admin.AdminSite):
|
||||||
|
"""
|
||||||
|
Customized administration site.
|
||||||
|
"""
|
||||||
|
|
||||||
|
site_header = "Sophon Server Administration"
|
||||||
|
site_title = "Sophon Server Administration"
|
||||||
|
site_url = None
|
||||||
|
|
||||||
|
index_title = "Resources Administration"
|
|
@ -1,15 +1,18 @@
|
||||||
from django.contrib import admin
|
import django.contrib.admin
|
||||||
|
import django.contrib.auth.models
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
django.contrib.admin.site.unregister(django.contrib.auth.models.Group)
|
||||||
|
|
||||||
class SophonAdmin(admin.ModelAdmin):
|
|
||||||
|
class SophonAdmin(django.contrib.admin.ModelAdmin):
|
||||||
"""
|
"""
|
||||||
Base :class:`django.contrib.admin.ModelAdmin` class from which all other admin classes inherit.
|
Base :class:`django.contrib.admin.ModelAdmin` class from which all other admin classes inherit.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.SophonInstanceDetails)
|
@django.contrib.admin.register(models.SophonInstanceDetails)
|
||||||
class SophonInstanceDetails(SophonAdmin):
|
class SophonInstanceDetails(SophonAdmin):
|
||||||
list_display = (
|
list_display = (
|
||||||
"name",
|
"name",
|
||||||
|
@ -28,7 +31,7 @@ class SophonInstanceDetails(SophonAdmin):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.ResearchGroup)
|
@django.contrib.admin.register(models.ResearchGroup)
|
||||||
class ResearchGroupAdmin(SophonAdmin):
|
class ResearchGroupAdmin(SophonAdmin):
|
||||||
list_display = (
|
list_display = (
|
||||||
"slug",
|
"slug",
|
||||||
|
|
|
@ -265,7 +265,7 @@ BASE_DIR = pathlib.Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
# Define the installed django apps
|
# Define the installed django apps
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
'django.contrib.admin',
|
'sophon.admin.SophonAdminConfig',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
|
@ -299,7 +299,9 @@ ROOT_URLCONF = 'sophon.urls'
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
{
|
{
|
||||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
'DIRS': [],
|
'DIRS': [
|
||||||
|
BASE_DIR / "sophon" / "templates"
|
||||||
|
],
|
||||||
'APP_DIRS': True,
|
'APP_DIRS': True,
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'context_processors': [
|
'context_processors': [
|
||||||
|
|
56
backend/sophon/templates/admin/base.html
Normal file
56
backend/sophon/templates/admin/base.html
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{% extends 'admin/base.html' %}
|
||||||
|
|
||||||
|
{% block extrahead %}
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--body-fg: rgb(45, 154, 255);
|
||||||
|
--body-bg: rgb(0, 0, 20);
|
||||||
|
--body-quiet-color: rgb(34, 115, 191);
|
||||||
|
--body-loud-color: rgb(255, 255, 255);
|
||||||
|
|
||||||
|
--primary: rgb(2, 10, 34);
|
||||||
|
--primary-fg: rgb(45, 154, 255);
|
||||||
|
|
||||||
|
--secondary: rgb(5, 24, 54);
|
||||||
|
|
||||||
|
--accent: rgb(255, 255, 255);
|
||||||
|
|
||||||
|
--darkened-bg: var(--primary);
|
||||||
|
--hairline-color: var(--secondary);
|
||||||
|
--border-color: var(--secondary);
|
||||||
|
--button-bg: var(--secondary);
|
||||||
|
--button-hover-bg: rgba(45, 154, 255, 0.2);
|
||||||
|
--close-button-bg: var(--secondary);
|
||||||
|
--close-button-hover-bg: rgba(45, 154, 255, 0.2);
|
||||||
|
|
||||||
|
--link-fg: rgb(0, 202, 202);
|
||||||
|
--link-hover-color: rgb(30, 232, 232);
|
||||||
|
--link-selected-fg: rgb(60, 255, 255);
|
||||||
|
--breadcrumbs-link-fg: rgb(0, 202, 202);
|
||||||
|
|
||||||
|
--error-fg: rgb(255, 125, 125);
|
||||||
|
--message-success-bg: rgba(125, 255, 125, 0.2);
|
||||||
|
--message-warning-bg: rgba(255, 255, 125, 0.2);
|
||||||
|
--message-error-bg: rgba(255, 125, 125, 0.2);
|
||||||
|
--selected-row: rgba(45, 154, 255, 0.2);
|
||||||
|
--selected-bg: rgba(45, 154, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* WHY?!?!?! */
|
||||||
|
|
||||||
|
#user-tools a {
|
||||||
|
color: var(--link-fg) !important;
|
||||||
|
border-bottom-color: var(--link-fg) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#user-tools a:focus, #user-tools a:hover {
|
||||||
|
color: var(--link-hover-color) !important;
|
||||||
|
border-bottom-color: var(--link-hover-color) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#user-tools a:active {
|
||||||
|
color: var(--link-selected-fg) !important;
|
||||||
|
border-bottom-color: var(--link-selected-fg) !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue