Package: django-preferences
Django PreferencesDjango 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 ensure only one preference instance per site is available for eachPreferencesclass.Requiresand supportsDjango’s “sites” framework, which means you can have multiple preferences, each associated with a particular site.ContentsDjango PreferencesRequirementsInstallationUsageAuthorsChangelognext0.20.10.0.60.0.5 (2011-08-17)0.0.4 (2011-08-11)0.0.30.0.20.0.1RequirementsPython 2.7, 3.5-3.7Django 1.11, 2.0, 2.1django.contrib.sitesInstallationInstall or adddjango-preferencesto your Python path.Addpreferencesto yourINSTALLED APPSsetting.Adddjango.contrib.sitesto yourINSTALLED APPSsetting. django-preferences associates preferences to specific sites and thus requires Django’s “sites” framework to be installed.Optionally, addpreferences.context_processors.preferences_cpto your template option settings. This will automatically add apreferencesvariable to your template context:TEMPLATES = [{
    ...
    'OPTIONS': {
        'context_processors': [
            ...
            'preferences.context_processors.preferences_cp',
        ],
    },
}]UsageTo create preferences for your app create a Django ORM model as usual, with the model inheriting frompreferences.models.Preferences. Also specifypreferences.modelsas your model’s module:from django.db import models
from preferences.models import Preferences

class MyPreferences(Preferences):
    portal_contact_email = models.EmailField()Admin classes are specified as per usual, except that they have to inherit from or be registered withpreferences.admin.PreferencesAdmin, i.e.:from django.contrib import admin

from preferences.admin import PreferencesAdmin
from <my_app>.models import MyPreferences

admin.site.register(MyPreferences, PreferencesAdmin)When your model is registered with admin it will show up under thePreferencesapp label in Django admin.Preferences can be accessed in Python by importing thepreferencesmodule and traversing to your required preference in the formpreferences.<ModelName>.<field>, i.e.:from preferences import preferences

portal_contact_email = preferences.MyPreferences.portal_contact_emailIf you’ve specified thepreferences.context_processors.preferences_cpas aTEMPLATESyou can similarly access your preferences within templates through thepreferencesvariable, i.e.:{{ preferences.MyPreferences.portal_contact_email }}AuthorsPraekelt ConsultingShaun SephtonEuan JonkerHedley RoosChangelognextDjango 2 and Python 3.5 compatibility. Django 1.9 is no longer supported.1.0.0
—
#. Support Django 1.11, 2.0 & 2.1 remove support for Django < 1.11
#. Support Python 2.7, 3.5-3.7
#. Added tests coverage0.2Move to tox for tests.Django 1.9 to 1.11 support. The official minimum supported version is 1.9.0.1Cleanup and fixing of tests courtesy of senyor.Rewrite distinct query so it works with Oracle backend.0.0.6Better packaging.0.0.5 (2011-08-17)Added sites support.Added unittests.0.0.4 (2011-08-11)Cleanup. Docs polish.0.0.3Spelling correction, thanks tiktuk.0.0.2Doc update to indicate importance of placing url include before admin url include.0.0.1First super alpha release.