Skip to content
Snippets Groups Projects
Commit 1de2ee94 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: allow customization of django admin backend

The login dialog header and the page header of the steering admin
interface are confusing because the naming and URLs don’t match up with
user expectations.

This adds sensible defaults and allows administrators to customize the
values for their specific needs.
parent 18adbe89
Branches feat/site-data
No related tags found
1 merge request!63feat: allow customization of django admin backend
Pipeline #8828 failed
...@@ -21,6 +21,11 @@ from program.models import ( ...@@ -21,6 +21,11 @@ from program.models import (
Type, Type,
) )
# This URL is used in the Django admin backend to "View [the] Site".
# Steering doesn’t have a public facing website so it doesn’t make sense to keep the default.
admin.site.site_url = settings.SITE_WEBSITE_URL
admin.site.site_header = settings.SITE_NAME
@admin.register(Category, FundingCategory, MusicFocus, Topic, Type) @admin.register(Category, FundingCategory, MusicFocus, Topic, Type)
class AdminWithNameSlugIsActive(admin.ModelAdmin): class AdminWithNameSlugIsActive(admin.ModelAdmin):
......
...@@ -214,6 +214,12 @@ SITE_URL = os.getenv( ...@@ -214,6 +214,12 @@ SITE_URL = os.getenv(
"SITE_URL", "SITE_URL",
default=f"{AURA_PROTO}://{AURA_HOST}:{PORT}" if PORT else f"{AURA_PROTO}://{AURA_HOST}", default=f"{AURA_PROTO}://{AURA_HOST}:{PORT}" if PORT else f"{AURA_PROTO}://{AURA_HOST}",
) )
# SITE_URL and SITE_WEBSITE_URL are likely the same (hence the default),
# but may differ in some setups that serve steering on a separate domain
# instead of the default sub-path.
# This will usually point to the URL of the dashboard.
SITE_WEBSITE_URL = os.getenv("SITE_WEBSITE_URL", default=SITE_URL)
SITE_NAME = os.getenv("SITE_NAME", default="AURA Backend")
if AURA_PROTO == "https": if AURA_PROTO == "https":
CSRF_TRUSTED_ORIGINS = [f"{AURA_PROTO}://{AURA_HOST}"] CSRF_TRUSTED_ORIGINS = [f"{AURA_PROTO}://{AURA_HOST}"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment