Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

This package provides a way to ensure singleton classes can only have one instance in the Django admin panel. It is taken from Mezzanine by Stephen McDonald.

Project description


This package provides a way to ensure singleton classes can only have one instance in the
Django admin panel. The package contains:

*, which defines the SingletonAdmin class, preventing adding if an instance already exists.
* templates/admin/singleton_enabled_base.html, which hides the relevant "add" buttons on the admin.

The file is taken directly from Mezzanine by Stephen McDonald,

The template file is taken from a talk at SyDjango by Stephen McDonald,


See Mezzanine for more details.

Quick start

1. Add the app to your INSTALLED_APPS setting like this::


2. In your singleton model's file, register it with the admin using this class, e.g.::

from django_singleton_admin.admin import SingletonAdmin

class GlobalSettingsAdmin(SingletonAdmin):
pass, GlobalSettingsAdmin)

3. Extend the admin template "admin/" using the provided base instead of
of the usual "admin/base.html", i.e. using:

{% extends "admin/singleton_enabled_base.html" %}

Note that this template uses the "extrastyle" block, so if you also override that, you
will need to copy the contents of the provided template into your code instead.
(In that case you may not need to add the app to your installed apps either.)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-singleton-admin, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size django-singleton-admin-0.0.4.macosx-10.7-intel.exe (69.3 kB) File type Windows Installer Python version any Upload date Hashes View
Filename, size django-singleton-admin-0.0.4.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page