Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Reusable app for Django introducing site preferences system

Project description

http://github.com/idlesign/django-siteprefs

LBC Python 2
https://img.shields.io/pypi/v/django-siteprefs.svg https://img.shields.io/pypi/l/django-siteprefs.svg https://img.shields.io/coveralls/idlesign/django-siteprefs/master.svg https://img.shields.io/travis/idlesign/django-siteprefs/master.svg

What’s that

django-siteprefs allows Django applications settings to come alive

Let’s suppose you have your pretty settings.py file with you application:

from django.conf import settings

MY_OPTION_1 = getattr(settings, 'MY_APP_MY_OPTION_1', True)
MY_OPTION_2 = getattr(settings, 'MY_APP_MY_OPTION_2', 'Some value')
MY_OPTION_42 = getattr(settings, 'MY_APP_MY_OPTION_42', 42)

Now you want these options to be exposed to Django Admin interface. Just add the following:

# To be sure our app is still functional without django-siteprefs.
if 'siteprefs' in settings.INSTALLED_APPS:

    from siteprefs.toolbox import preferences

    with preferences() as prefs:
        # And that's how we expose our options to Admin.
        prefs(MY_OPTION_1, MY_OPTION_2, MY_OPTION_42)

After that you can view your settings in Django Admin.

If you want those settings to be editable through the Admin - siteprefs allows that too, and even more.

Read the docs ;)

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-siteprefs, version 1.2.0
Filename, size File type Python version Upload date Hashes
Filename, size django_siteprefs-1.2.0-py2.py3-none-any.whl (22.6 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size django-siteprefs-1.2.0.tar.gz (22.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