{% load i18n %} {% comment %} User menu for the admin header: identity, language switcher, theme switcher (auto/light/dark) and account shortcuts (change password, log out). Context (from django_admin_home.context_processors): - admin_home_user_initials — via admin_user - admin_home_languages — via admin_languages, [] if not wired up Language switching uses Django's native ``set_language`` view (one POST per language, with ``next`` set to the current page) — no custom view. Theme switching replicates the Django admin's own ``theme.js`` contract (``localStorage.theme`` + ``data-theme`` on ````) instead of calling into it, since that script keeps its ``setTheme`` in a closure — see ``static/django_admin_home/js/user_menu.js``. To add extra account-menu links (e.g. a project-specific tool), override "admin_home/_user_menu_extra_actions.html" in your own templates dir. {% endcomment %} {% comment %} Django 4.2 applies its saved theme only at window.load, which flashes the light palette first. This synchronous bootstrap runs while the document is still being parsed, before this header can be painted. {% endcomment %}