Last Updated: December 01, 2017
· miguelmramos
Avatar small

Django Custom Dashboard Easy

On other day, i struggle with django. WOW. I need a quick dashboard not all that apps lists. I usually use django-suit for my projects and that's really awesome. So make a new administration, no. The main admin do at i need but i want only a custom dashboard. Apply some freak apps to modify my main dashboard, nope i want total control to insert i want. So after many patch, try, error, do it something to it. What i'be done was simple subclass AdminSite an override the get_urls and put my custom index view on it.

So created a app called plus. In there a inserted two files, and On sites did this:

from django.contrib.admin.sites import AdminSite

class AdminMixin(object):
    """Mixin for AdminSite to allow custom dashboard views."""

    def __init__(self, *args, **kwargs):
        return super(AdminMixin, self).__init__(*args, **kwargs)

    def get_urls(self):
        """Add our dashboard view to the admin urlconf. Deleted the default index."""
        from django.conf.urls import patterns, url
        from views import DashboardWelcomeView

        urls = super(AdminMixin, self).get_urls()
        del urls[0]
        custom_url = patterns('',
               url(r'^$', self.admin_view(DashboardWelcomeView.as_view()), 

        return custom_url + urls

class SitePlus(AdminMixin, AdminSite):
    A Django AdminSite with the AdminMixin to allow registering custom
    dashboard view.
from django.views.generic import TemplateView

class DashboardWelcomeView(TemplateView):
    template_name = 'admin/dashboard/welcome.html'

    def get(self, request, *args, **kwargs):
        context = self.get_context_data(**kwargs)

        return self.render_to_response(context=context)

Now our class for override on urls are ready. Let's make it happen.

from django.contrib import admin
from import SitePlus = SitePlus()

urlpatterns = patterns('',
    url(r'^admin/', include(,

Admin site takes our new class to resolve our custom view. I made a TemplateView but it's up to you if you want on self index() or a custom view.

So, where it is my new dashboard view. As i said, if you use django-suit for template you will have a menu on left for your application and now a custom space for you dashboard. And that's it.


Say Thanks

6 Responses
Add your response

Default profile 1 normal

I've followed your code, but it seems that the custom template renders on the whole page. I cannot see django-suit menu on the left.

over 1 year ago ·
Avatar small

Did you extend your template from base_site? Seems to me a problem rendering django-suit. Check if it is installed and make collect static.

over 1 year ago ·

Exception Value:

No module named

over 1 year ago ·
2fd44750200affe01073bf3ea63fcf82 normal

it's working thank you!!!!!!

over 1 year ago ·

Could you show your welcome.html, please? My apps also disappeared form Django Suit left menu.

I exended basesite.html, but can't see my apps. Just HOME
{% extends "admin/base
site.html" %}

over 1 year ago ·

I had exactly the situation as raidlogs and mribeirodantas, all the menu on the left hand has disappeared, do you know how to fix the problem? Thanks in advance

over 1 year ago ·