Skip to main content

Django Admin Plus

Custom Wiews for Django Admin made simple.

Community-Project

PyPI - Supported versions PyPI - Package version PyPI - Downloads PyPI - License Codacy Grade Badge Codacy Coverage Badge Gitlab Pipeline Status

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.

📜 About and Motivation

Forked from https://github.com/jsocol/django-adminplus

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.

✨ Features

  • Register custom views to the Django admin that are not tied to any model.
  • Support for both function-based and class-based views.
  • Decorator syntax for registering views (@admin.site.register_view).
  • Customizable display names for views in the admin index.
  • Named URL patterns for use with reverse() and redirect().
  • Conditional visibility control via boolean or callable visible parameter.
  • Automatic admin authentication wrapping for all registered views.
  • Custom admin index template with a "Custom Views" section.
  • Drop-in replacement for Django's AdminSite with AdminSitePlus.
  • Base template with breadcrumb navigation for admin-styled pages.
  • Fully compatible with the built-in Django admin module.

📋 Requirements

  • Python 3.11 or higher
  • Django 4.2 or higher

📦 Installation

Using pip

pip install django-sb-adminplus

Using uv

uv add django-sb-adminplus

🚀 Usage

And add django_sb_adminplus to your installed apps, and replace django.contrib.admin with django.contrib.admin.apps.SimpleAdminConfig:

INSTALLED_APPS = (
    'django.contrib.admin.apps.SimpleAdminConfig',
    # ...
    'django_sb_adminplus',
    # ...
)

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

# urls.py
from django.contrib import admin
from django.urls import path
from django_sb_adminplus.sites import AdminSitePlus

admin.site = AdminSitePlus()
admin.autodiscover()

urlpatterns = [
    # ...
    # Include the admin URL conf as normal.
    path('admin/', admin.site.urls),
    # ...
]

Congratulations! You're now using AdminPlus.

Create custom views

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, admin.site.register_view, to attach arbitrary views to the admin:

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

def my_view(request, *args, **kwargs):
    pass

admin.site.register_view('somepath', view=my_view)

# And of course, this still works:
from someapp.models import MyModel
admin.site.register(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:

@admin.site.register_view('somepath')
def my_view(request):
    pass

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!"""
    admin.site.register_view('somepath', 'My Fancy Admin View!', view=my_view)
    
  • urlname: give a name to the urlpattern so it can be called by redirect(), reverse(), etc. The view will be added to the admin namespace, so a urlname of foo would be reversed with reverse("admin:foo").

  • 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 admin.site.admin_view.

Note

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

Metadata

Release files for django-sb-adminplus 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-sb-adminplus 0.8.0
File Size Uploaded Provenance
django_sb_adminplus-0.8.0.tar.gz 16.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sb-adminplus 0.8.0
File Interpreter ABI Platform
django_sb_adminplus-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / django_sb_adminplus-0.8.0.tar.gz

Download URL django_sb_adminplus-0.8.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0bc25cc66f172e2d012dbbd385d1d5977201d9b1a912e0fc1e61534c440c6483
BLAKE2b-256 checksum
How to use checksums
c65376f5e2bbc028fb854f43e90fd2fe64d840b72f1dd51720841d2d2a00afb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / django_sb_adminplus-0.8.0-py3-none-any.whl

Download URL django_sb_adminplus-0.8.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e2ac1e75625e9c37499b5868419383f9e904937eae609a277f844ef27194b32
BLAKE2b-256 checksum
How to use checksums
e91ffb6a155959153d85dffecbf3c53f05c84f9a08fb1062329355f446a78efd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for django-sb-adminplus 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page