<commit_before>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
------------

#. Add **preferences** to your **INSTALLED APPS** setting.

#. 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
~~~~~
#. Spelling correction, thanks tiktuk.

0.0.2
~~~~~
#. Doc update to indicate importance of placing url include before admin url include.

0.0.1
~~~~~
#. First super alpha release.

<commit_msg>cleanup<commit_after>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 ensure only one preference intance is available for each ``Preferences`` class.

.. contents:: Contents
    :depth: 5

Installation
------------

#. Install or add ``django-preferences`` to your Python path.

#. Add ``preferences`` to your ``INSTALLED APPS`` setting.

#. 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 Django ORM model as usual, 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. When your model is registered with admin it 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 preference in the form ``preferences.<ModelName>.<field>``, i.e.::

    from preferences import preferences

    portal_contact_email = preferences.MyPreferences.portal_contact_email



{'fraction_non_alphanumeric': 0.09699570815450644, 'fraction_numerical': 0.002861230329041488, 'mean_word_length': 4.241379310344827, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1613088', 'n_tokens_mistral': 862, 'n_tokens_neox': 823, 'n_words': 403}