Django admin: How to add a custom page?

Search for a command to run...

No comments yet. Be the first to comment.
C# is one of my favorite languages; if you're building Windows apps, you're probably better off with C#, but I'm kind of rusty, and WinForms is old school now, so I've no choice but to use WPF 😔. The

I have been thinking about where we are at with AI in 2026; I think most models have now reached their intelligence ceiling. They’ll get incrementally better over time, sure, but there’s a big difference between 10% to 80% and 80% to 100%. In most te...

Django is one of my favourite frameworks; however, the official docs are not always the best resource to look up information when you are in a hurry. Don't get me wrong, the official docs are very use

While the whole YouTube influencer space goes crazy about Gemini 3, I’m not so impressed. Don’t get me wrong, Gemini models are fantastic! And the V3 iteration is undoubtedly cool and capable. I’ve briefly run some tests (not benchmarks but actual re...

I’m learning Next.js; I know React or kinda know React since I started building React apps in 2018 or thereabout, and then stopped using it for several years. Shew! A lot has changed: Server actions, Zod, and just the whole ecosystem generally. This ...

Django admin is a powerful tool to build admin panels rapidly. With just a few lines of code, you can have a fully functional admin panel in seconds.
The problem though is customization, one of the most common customizations you'll do often is add a custom Django admin page or section.
Naturally, in doing so, you would want your custom admin section to have the same look and feel as the "ModelAdmin" or other Django Admin-generated views.
One approach is to extend the Django admin base template and register a custom route in "urls.py":
{% extends 'admin/base.html' %}
The problem with this approach is that you will not have access to any variables set by Django Admin, thus you have to get that data and pass it to the template manually. Example: the sidebar links.
class CustomAdminSite(admin.AdminSite):
def get_urls(self):
custom_urls = [
path('some-custom-url/', self.admin_view(SomeCustomView.as_view(admin=self))),
]
admin_urls = super().get_urls()
return custom_urls + admin_urls
site = CustomAdminSite(name="my-fancy-url")
admin.site = site
# admin.register....your...modeladmin
The above will allow you to render your custom view at "/admin/some-custom-url".
For our custom URL above we reference a class-based view: "SomeCustomView", here is an example implementation:
from django.shortcuts import render
from django.views.generic import ListView
class SomeCustomView(ListView):
admin = {}
def get(self, request):
ctx = self.admin.each_context(request)
return render(request, 'somecustomview.html', ctx)
Finally, you simply need to extend the Django admin base template and replace the content section with whatever you want to display on your page:
{% extends 'admin/base.html' %}
{% block content %}
Hello World
{% endblock %}
Wasn't that simple? Django admin is powerful yet cryptic sometimes, making it difficult to customize. However, once you learn the basics, Django Admin will make your life so much simpler.
Compared to other CRUD generators and admin tools, Django admin just feels clean and easy to use. Plus it will save you a ton of time.