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

Configuration admin/models for Django.

Project description

Some site wide settings belong in the database. This Django-Configure provides a familiar way to implement this pattern. It uses django-polymorphic, mostly to provide a clean admin interface. Any model field can be used in a configuration, and any of the standard django admin utilities (like permissions) can be used.


Install from pypi using your favorite method::

pip install django-configuration


In myapp/

from configuration.models import Configuration

class MyConfiguration(Configuration):
    my_var = models.CharField(max_length=255, default='Hello!')

Then elsewhere::

>>> from myapp.models import MyConfiguration
>>> print MyConfiguration.objects.get()

A Configuration instance is not saved to the database until save is explicitly called or until it is saved in the admin, so it is important to specify default values on your fields.

A custom admin interface can be provided as follows::

from configuration.models import Configuration
from configuration.admin import ConfigurationAdmin

class MyAdmin(ConfigurationAdmin):

class MyConfiguration(Configuration):
    my_var = models.CharField(max_length=255, default='Hello!')

    admin_class = MyAdmin

The admin class must inherit from ConfigurationAdmin. The admin_class attribute can also be given as a dotted string::

class MyConfiguration(Configuration):
    my_var = models.CharField(max_length=255, default='Hello!')

    admin_class = 'myapp.admin.MyAdmin'

Efficiency and Caching

Django-Configuration is quick, easy and intuitive, and allows you to follow django patterns. However it is not the most efficient method of keeping configuration optinos in the database. The use of django-polymorphic allows for a great admin interface but makes queries more costly. The library currently provides no caching - although caching apps that cache query results should help with that.

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-configuration, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size (8.5 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