How to Change Django Admin Text

How to Change Django Admin Text

If you’ve ever wondered how to change django admin text, this guide shows multiple safe, upgrade‑friendly ways to adjust wording across the admin: headers, page titles, model/app labels, actions, login copy, and even built‑in messages. We’ll go from the quickest wins to deeper template and i18n overrides, so you can pick the right tool for the job and keep your changes maintainable over time.

1) Pick the right approach (map what you want to change)

Most “text changes” fall into a few buckets: (a) global branding (the “Django administration” header/title), (b) page‑level titles like the dashboard’s index title, (c) model/app/field labels, (d) action button and dropdown labels, (e) login page copy, and (f) built‑in success/error messages. Different buckets have different best‑practice knobs.

A simple rule: prefer official API attributes (e.g., admin.site.site_header) and model metadata (verbose_name) first. Use template overrides for layout/labels, and i18n only when you need to replace framework strings without editing templates.

Quick note: Keep changes small and local—future you will thank you during Django upgrades.

2) Quick global branding via admin.site attributes

For site‑wide wording (header, browser title, index title), use the public attributes exposed by AdminSite. In your project’s admin.py (any installed app is fine), add:

# app/admin.py
from django.contrib import admin

admin.site.site_header = "Prime Inspire Admin"
admin.site.site_title = "Prime Inspire Admin Portal"
admin.site.index_title = "Welcome — Manage Your Content"
Code language: PHP (php)

This instantly updates the big header text, the HTML <title>, and the dashboard heading—no templates required. It’s the fastest, most upgrade‑proof option for basic changes.

Quick note: Restart the dev server if you don’t see the changes; cached templates or server state can delay updates.

3) Override admin templates for precise wording

When you need to change specific strings or blocks (e.g., the “Django administration” link text), override admin templates. First ensure Django can find your project templates:

# settings.py
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent

TEMPLATES = [{
    "BACKEND": "django.template.backends.django.DjangoTemplates",
    "DIRS": [BASE_DIR / "templates"],  # <-- enable project templates
    "APP_DIRS": True,
    "OPTIONS": {"context_processors": [
        "django.template.context_processors.debug",
        "django.template.context_processors.request",
        "django.contrib.auth.context_processors.auth",
        "django.contrib.messages.context_processors.messages",
    ]},
}]
Code language: PHP (php)

Now create templates/admin/base_site.html:

{% extends "admin/base.html" %}
{% block title %}Prime Inspire Admin{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">Prime Inspire Admin</a></h1>
{% endblock %}
Code language: HTML, XML (xml)

This replaces the default admin branding text/link without touching Django’s source.

Quick note: Template paths must match admin/... exactly; a typo means Django will fall back to its defaults.

4) Rename apps, models, and fields (what users actually see)

Most headings in change lists and breadcrumbs come from model metadata. To change them cleanly, use verbose_name/verbose_name_plural on models and verbose_name on fields:

# app/models.py
from django.db import models

class Article(models.Model):
    title = models.CharField("Headline", max_length=200)  # field label
    body = models.TextField("Story")

    class Meta:
        verbose_name = "Article"
        verbose_name_plural = "Articles"

To change the app label in the sidebar, give your app’s AppConfig a friendlier name:

# app/apps.py
from django.apps import AppConfig

class BlogConfig(AppConfig):
    default_auto_field = "django.db.models.BigAutoField"
    name = "app"
    verbose_name = "Content"

Quick note: Ensure your app’s __init__.py sets default_app_config (Django<3.2) or you reference the config path in INSTALLED_APPS (Django 3.2+ auto‑config usually “just works”).

5) Customize action labels and success messages

The “Actions” dropdown uses the function’s description. Give actions human‑friendly text with the decorator:

# app/admin.py
from django.contrib import admin
from .models import Article

@admin.action(description="Publish selected articles")
def publish_selected(modeladmin, request, queryset):
    updated = queryset.update(status="published")
    modeladmin.message_user(request, f"{updated} article(s) published.")

@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    actions = [publish_selected]

For built‑in add/change/delete messages, you can override hooks and call message_user yourself to replace wording or add extra context after saves/deletes.

Quick note: Avoid overriding the entire template just to rename an action—use the decorator when possible.

6) Edit the login page text (and other page copy)

To change the login page wording (“Log in”, helper text, etc.), override templates/admin/login.html:

{% extends "admin/login.html" %}
{% block content_title %}<h1>Please sign in to Prime Inspire Admin</h1>{% endblock %}
{% block content %}
  {{ block.super }}
  <p class="help">Use your staff credentials. Problems? Contact the site admin.</p>
{% endblock %}
Code language: HTML, XML (xml)

You can also tweak base_site.html blocks like userlinks or breadcrumbs to adjust small bits of copy across pages without re‑implementing entire templates.

Quick note: Keep overrides minimal—extend the original and change only necessary blocks.

7) Replace built‑in strings via i18n (without templates)

If you want to change framework strings (like the default “Log out” or “Delete selected …”) everywhere without editing templates, use Django’s translation system for your active language:

  1. In settings.py, set LANGUAGE_CODE = "en" (or your target), and add "django.middleware.locale.LocaleMiddleware" to MIDDLEWARE.
  2. Run django-admin makemessages -l en (use your locale code).
  3. In the generated .po file under locale/en/LC_MESSAGES/django.po, find the original msgids (e.g., msgid "Log out") and set your msgstr.
  4. Run django-admin compilemessages and restart.

This swaps text at render time via translations, no template overrides needed.

Quick note: i18n overrides are global—great for consistent wording, but document them so teammates understand why text changed.

8) Fine‑tune page titles and headings (advanced template blocks)

Some headings (like change‑form titles) come from blocks such as content_title. You can surgically adjust them by overriding only those blocks:

{# templates/admin/change_form.html #}
{% extends "admin/change_form.html" %}
{% block content_title %}
  <h1>Edit {{ opts.verbose_name|capfirst }} — Prime Inspire</h1>
{% endblock %}
Code language: HTML, XML (xml)

Likewise, the dashboard (index.html) can be extended to rename “Recent actions” or add helper text near app lists—use sparingly to avoid drift from Django’s upstream changes.

Quick note: When you override per‑page templates, re‑test after Django upgrades since upstream HTML can evolve.

9) Keep it upgrade‑proof and organized

Create a small “admin overrides” checklist in your repo README: which attributes you changed, which templates you override, and which i18n strings you replaced. Group all template overrides under templates/admin/ and keep copy in settings (like site_title) in one admin.py.

Run through a short regression pass after upgrading Django: (a) sign‑in page, (b) index dashboard titles, (c) a change list, (d) a change form, (e) actions and messages. Fix any broken block names or selectors early.

Quick note: Prefer API attributes and model metadata first; template and i18n overrides are your precision tools, not your default hammer.

10) Quick troubleshooting

If text isn’t changing, verify the template path and that your TEMPLATES['DIRS'] includes your project templates/ folder. Confirm your template override actually extends the correct Django template (names must match exactly). Clear your browser cache or disable template caching in dev.

For i18n, make sure compilemessages ran without errors and that your LANGUAGE_CODE/LocaleMiddleware are configured. Rebuild containers or restart servers so the compiled .mo files are loaded.

Quick note: When in doubt, temporarily inject a distinctive word (e.g., “Zebra”) in your override—if you don’t see it, Django isn’t picking up your file.

Copy‑paste checklist (TL;DR)

  1. Global branding: set admin.site.site_header/site_title/index_title in admin.py.
  2. Precise copy changes: override templates/admin/base_site.html, index.html, login.html, or specific pages.
  3. Labels everywhere else: use verbose_name/verbose_name_plural (models), verbose_name (fields), and AppConfig.verbose_name (app).
  4. Actions & messages: @admin.action(description="…") and message_user(...).
  5. Framework strings: i18n with makemessages/compilemessages.

Quick note: You now have multiple safe paths to adjust wording—choose the lightest tool that meets your need.


Discover more from Prime Inspire

Subscribe to get the latest posts sent to your email.

We’d love to hear your thoughts! Share your ideas below 💡

Scroll to Top

Discover more from Prime Inspire

Subscribe now to keep reading and get access to the full archive.

Continue reading