If you want to override the site header and site title in your Django admin, most people start with overriding the admin templates. Even though that's a perfectly fine approach, I prefer to do it differently.

I first start with creating a subclass of admin.AdminSite:

mysite/admin.py

from django.contrib import admin

class YellowDuckAdminSite(admin.AdminSite):
    site_header = "YellowDuck.be"
    site_title = "YellowDuck.be"

Then, you need to use it as the default_site for your AdminConfig subclass:

mysite/apps.py

from django.contrib.admin.apps import AdminConfig

class YellowDuckAdminConfig(AdminConfig):
    default_site = 'mysite.admin.YellowDuckAdminSite'

As the last step, you need to replace django.contrib.admin with your admin config class:

mysite/settings.py

INSTALLED_APPS = [
    ...
    'mysite.apps.YellowDuckAdminConfig', # replaces django.contrib.admin
    ...
]

You can find more info in the documentation about this approach.

Related Posts

  • Automating Django admin tasks
  • Scheduling recurring tasks in Django
  • Making publish the default action in Wagtail
  • Programatically creating redirects in Wagtail
  • Outputting a Django queryset as JSON