Skip to main content

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 BEFORE your admin urls include statement. 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.models 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

Change Log

0.0.3

  1. Spelling correction, thanks tiktuk.

0.0.2

  1. Doc update to indicate importance of placing url include before admin url include.

0.0.1

  1. First super alpha release.

Metadata

Release files for django-preferences 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-preferences 0.0.3
File Size Uploaded
django-preferences-0.0.3.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-preferences 0.0.3
File Interpreter ABI Platform
django_preferences-0.0.3-py2.6.egg Legacy Egg format - - Details

Total release size: 10.5 kB

Release files / django-preferences-0.0.3.tar.gz

Download URL django-preferences-0.0.3.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5887929975af8abd8e9c52580efb5cfe706fa6454787d1a099e485c0001137d1
BLAKE2b-256 checksum
How to use checksums
2b4dcd3296eeafcaebfe130f0e8cb7850023a3b425a977c56872ea0b2ccd739c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_preferences-0.0.3-py2.6.egg

Download URL django_preferences-0.0.3-py2.6.egg
Size 6.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
030f27c7bfad809eb7b7c2a2ca62b88716810347c55e1de2c1917f262d4b5f7d
BLAKE2b-256 checksum
How to use checksums
37e3e1766e85e7ab5a9f945f21c0572840dd22213f3096465cb438c61d587f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.0

1 release file

0.2

2 release files

0.1

2 release files

0.0.6

3 release files

0.0.5

3 release files

0.0.4

3 release files

This release

0.0.3 This release

2 release files

0.0.2

3 release files

0.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page