You have 3 options here:
Using third-party packages which provide menu
This is pretty straight forward, there are some good packages out there which support menu for admin, and some way to add your item to the menu.
An example of a 3rd party package would be django-admin-tools (last updated Dec 2021, checked April 2023). The drawback is that it is a bit hard to learn. Another option would be to use django-adminplus (last updated Oct 2019, checked April 2023) but at the time of writing this, it does not support Django 2.2.
Hacking with django admin templates
You can always extend admin templates and override the parts you want, as mentioned in @Sardorbek answer, you can copy some parts from admin template and change them the way you want.
Using custom admin site
If your views are supposed to only action on admin site, then you can extend adminsite (and maybe change the default), beside from adding links to template, you should use this method to define your admin-only views as it's easier to check for permissions this way.
Considering you already extended adminsite, now you can use the previous methods to add your link to template, or even extend get_app_list method, example:
class MyAdminSite(admin.AdminSite):
def get_app_list(self, request):
app_list = super().get_app_list(request)
app_list += [
{
"name": "My Custom App",
"app_label": "my_test_app",
# "app_url": "/admin/test_view",
"models": [
{
"name": "tcptraceroute",
"object_name": "tcptraceroute",
"admin_url": "/admin/test_view",
"view_only": True,
}
],
}
]
return app_list
You can also check if current staff user can access to module before you show them the links.
It will look like this at then end:

You have 3 options here:
Using third-party packages which provide menu
This is pretty straight forward, there are some good packages out there which support menu for admin, and some way to add your item to the menu.
An example of a 3rd party package would be django-admin-tools (last updated Dec 2021, checked April 2023). The drawback is that it is a bit hard to learn. Another option would be to use django-adminplus (last updated Oct 2019, checked April 2023) but at the time of writing this, it does not support Django 2.2.
Hacking with django admin templates
You can always extend admin templates and override the parts you want, as mentioned in @Sardorbek answer, you can copy some parts from admin template and change them the way you want.
Using custom admin site
If your views are supposed to only action on admin site, then you can extend adminsite (and maybe change the default), beside from adding links to template, you should use this method to define your admin-only views as it's easier to check for permissions this way.
Considering you already extended adminsite, now you can use the previous methods to add your link to template, or even extend get_app_list method, example:
class MyAdminSite(admin.AdminSite):
def get_app_list(self, request):
app_list = super().get_app_list(request)
app_list += [
{
"name": "My Custom App",
"app_label": "my_test_app",
# "app_url": "/admin/test_view",
"models": [
{
"name": "tcptraceroute",
"object_name": "tcptraceroute",
"admin_url": "/admin/test_view",
"view_only": True,
}
],
}
]
return app_list
You can also check if current staff user can access to module before you show them the links.
It will look like this at then end:

Problem here that your div is not inside main-content. I suggest extending admin/index.html
Put in app/templates/admin/index.html
{% extends "admin/index.html" %}
{% load i18n static %}
{% block content %}
<div id="content-main">
{% if app_list %}
{% for app in app_list %}
<div class="app-{{ app.app_label }} module">
<table>
<caption>
<a href="{{ app.app_url }}" class="section" title="{% blocktrans with name=app.name %}Models in the {{ name }} application{% endblocktrans %}">{{ app.name }}</a>
</caption>
{% for model in app.models %}
<tr class="model-{{ model.object_name|lower }}">
{% if model.admin_url %}
<th scope="row"><a href="{{ model.admin_url }}">{{ model.name }}</a></th>
{% else %}
<th scope="row">{{ model.name }}</th>
{% endif %}
{% if model.add_url %}
<td><a href="{{ model.add_url }}" class="addlink">{% trans 'Add' %}</a></td>
{% else %}
<td> </td>
{% endif %}
{% if model.admin_url %}
{% if model.view_only %}
<td><a href="{{ model.admin_url }}" class="viewlink">{% trans 'View' %}</a></td>
{% else %}
<td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td>
{% endif %}
{% else %}
<td> </td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endfor %}
<!-- here you could put your div -->
<div class="app-sonstiges module">
....
</div>
<!-- here you could put your div -->
{% else %}
<p>{% trans "You don't have permission to view or edit anything." %}</p>
{% endif %}
</div>
{% endblock %}
The another approach is to add custom app to app_list. But it is far more ugly. So I suggest overriding template.
I assume you are overriding get_urls in AdminSite.
» pip install django-admin-views
Django adding custom view in admin site - Stack Overflow
python - Make new custom view at django admin - Stack Overflow
How do I customise Django admin
[deleted by user]
Videos
This guide looks quite old. I would rather advise you to follow django docs.
someapp/admin.py
from django.contrib.admin import AdminSite
from django.http import HttpResponse
class MyAdminSite(AdminSite):
def get_urls(self):
from django.urls import path
urls = super().get_urls()
urls += [
path('my_view/', self.admin_view(self.my_view))
]
return urls
def my_view(self, request):
return HttpResponse("Hello!")
admin_site = MyAdminSite()
Source: https://github.com/django/django/blob/2.2/django/contrib/admin/sites.py#L194-L205
You should also update your project/urls.py and replace path('admin/', admin.site.urls) by path('admin/', admin_site.urls). Don't forget to from someapp.admin import admin_site before.
The guide you linked is old and I was surprised to not find anything directly answering your question in the last year or so.
- Create a new Admin Site in your app's admin.py or in a convenient place.
- Create a function in the new AdminSite that augments the
get_urls()function with your extra urls. - Make sure your project urls.py links to the newly created AdminSite.
The below works with Python 3.5.1 and Django 1.9.6.
my_app/admin.py
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.http import HttpResponse
from my_app.models import SomeModel
class MyAdminSite(AdminSite):
def custom_view(self, request):
return HttpResponse("Test")
def get_urls(self):
from django.conf.urls import url
urls = super(MyAdminSite, self).get_urls()
urls += [
url(r'^custom_view/$', self.admin_view(self.custom_view))
]
return urls
admin_site = MyAdminSite()
@admin.register(SomeModel, site=admin_site)
class SomeModelAdmin(admin.ModelAdmin):
pass
my_project/urls.py
from django.conf.urls import url, include
from my_app.admin import admin_site
urlpatterns = [
url(r'^admin/', admin_site.urls),
...
]
Rather then creating a custom admin change view I would approach this problem by extending the built in one, the django admin provides a number of hooks to facilitate this, here are my thoughts:
- Modify the default queryset but I would recommend against this as you loose the ability to edit objects not returned by the queryset.
- Create a custom filter that would display your 'broker list' queryset - I recommend this one as it further will give you a GET url query you can link to directly to activate this filter.
- You can even completely gut out the change view and use your own - this option I have the least experience with and can not comment.
You may wish to also take at look changing the change list template and admin custom actions to further customize the look and feel and to provide custom 'actions'; I have used both successfully in the past to provide project specific functionality.
Very exciting are the has_add_premission, had_change_permission, and has_delete_permission hooks, couple these with like django-guradian and custom admin base template could allow you to use the backend admin as a complete front end administration.
Do take the time to throughly read the entire model admin page - the better I know it the less I find myself coding custom front end administration.
If you want a custom view to be shown at the admin site, you can use "django admin plus" Its a library that allows you to bind custom views to admin site. You can use queries and models of your choice in that view and go on further as it was'nt admin site.
Try this django library and do share with us your feedback.
Your view should look something like this after registering it to admin.py
@admin.site.register_view('pathname')
def my_view(request):
do_something
Do share your experience with this library.
Have a good one