Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Easily add custom views to the Django admin.
Python HTML Shell
Branch: master

Merge pull request #33 from drdaeman/master

Allow `visible` to be a predicate
latest commit 02e8a37655
@jsocol authored


Django AdminPlus

AdminPlus aims to be the smallest possible extension to the excellent Django admin component that lets you add admin views that are not tied to models.

There are packages out there, like Nexus and django-admin-tools that replace the entire admin. Nexus supports adding completely new "modules" (the Django model admin is a default module) but there seems to be a lot of boiler plate code to do it. django-admin-tools does not, as far as I can tell, support adding custom pages.

All AdminPlus does is allow you to add simple custom views (well, they can be as complex as you like!) without mucking about with hijacking URLs, and providing links to them right in the admin index.

Installing AdminPlus

Install from PyPI with pip:

pip install django-adminplus

Or get AdminPlus from GitHub with pip:

pip install -e git://

And add adminplus to your installed apps:

    # ...
    # ...

To use AdminPlus in your Django project, you'll need to replace, which is an instance of django.contrib.admin.sites.AdminSite. I recommend doing this in right before calling admin.autodiscover():

from django.contrib import admin
from adminplus.sites import AdminSitePlus = AdminSitePlus()

urlpatterns = patterns('',
    # ...
    # Include the admin URL conf as normal.
    (r'^admin', include(,
    # ...

If you're using Django 1.7, you should also replace django.contrib.admin with django.contrib.admin.apps.SimpleAdminConfig in your installed apps, in order to disable the automatic auto-discovery:

    # ...
    'django.contrib.admin.apps.SimpleAdminConfig',  # instead of 'django.contrib.admin'
    # ...

Congratulations! You're now using AdminPlus.

Using AdminPlus

So now that you've installed AdminPlus, you'll want to use it. AdminPlus is 100% compatible with the built in admin module, so if you've been using that, you shouldn't have to change anything.

AdminPlus offers a new function,, to attach arbitrary views to the admin:

# someapp/
# Assuming you've replaced as above.
from django.contrib import admin

def my_view(request, *args, **kwargs):
    pass'somepath', view=my_view)

# And of course, this still works:
from someapp.models import MyModel

Now my_view will be accessible at admin/somepath and there will be a link to it in the Custom Views section of the admin index.

You can also use register_view as a decorator:'somepath')
def my_view(request):

register_view takes some optional arguments:

  • name: a friendly name for display in the list of custom views. For example:

    def my_view(request):
        """Does something fancy!"""'somepath', 'My Fancy Admin View!', view=my_view)
  • urlname: give a name to the urlpattern so it can be called by redirect(), reverse(), etc.

  • visible: a boolean or a callable returning one, that defines if the custom view is visible in the admin dashboard.

All registered views are wrapped in


Views with URLs that match auto-discovered URLs (e.g. those created via ModelAdmins) will override the auto-discovered URL.

Something went wrong with that request. Please try again.