Code Monkey home page Code Monkey logo

django-preferences's Introduction

Django Preferences

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.1

  1. First super alpha release

0.0.2

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

django-preferences's People

Contributors

tiktuk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.