Skip to main content

Django app allowing users to set app specific preferences through the admin interface.

Project description

Django app allowing users to set app specific preferences through the admin interface.

Provides singleton admin views for Preferences objects and a simple interface to preference values. Singleton views ensures only one preference intance is available for each Preferences class.

Installation

  1. Add preferences to your INSTALLED APPS setting.

  2. Add preferences url include to the project’s url.py file. Make sure to use ‘admin/’ as the start of the include’s path since it will override certain admin views:

    (r'^admin/', include('preferences.urls')),
    

Usage

To create preferences for your app create a model storing your preferences as normal, with the model inheriting from preferences.models.Preferences. Also specify preferences.models as your models module:

from django.db import models
from preferences.model import Preferences

class MyPreferences(Preferences):
    __module__ = 'preferences.models'
    portal_contact_email = models.EmailField()

Admin classes are specified as per usual, no changes are needed. Your preferences will show up under the Preferences app label in Django admin.

Preferences can be accessed in python by importing the preferences module and traversing to your required preferences in the form preferences.<ModelName>.<field>, i.e.:

from preferences import preferences

portal_contact_email = preferences.MyPreferences.portal_contact_email

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-preferences, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_preferences-0.0.1-py2.5.egg (6.6 kB) File type Egg Python version 2.5 Upload date Hashes View
Filename, size django_preferences-0.0.1-py2.6.egg (6.6 kB) File type Egg Python version 2.6 Upload date Hashes View
Filename, size django-preferences-0.0.1.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page