Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/idlesign/django-siteprefs
Reusable app for Django introducing site preferences system
https://github.com/idlesign/django-siteprefs
django preferences python
Last synced: 3 months ago
JSON representation
Reusable app for Django introducing site preferences system
- Host: GitHub
- URL: https://github.com/idlesign/django-siteprefs
- Owner: idlesign
- License: bsd-3-clause
- Created: 2013-08-07T15:14:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T12:45:15.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T13:40:44.618Z (4 months ago)
- Topics: django, preferences, python
- Language: Python
- Homepage: https://github.com/idlesign/django-siteprefs
- Size: 130 KB
- Stars: 17
- Watchers: 4
- Forks: 6
- Open Issues: 11
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
django-siteprefs
================
http://github.com/idlesign/django-siteprefs.. image:: https://img.shields.io/pypi/v/django-siteprefs.svg
:target: https://pypi.python.org/pypi/django-siteprefs.. image:: https://img.shields.io/pypi/l/django-siteprefs.svg
:target: https://pypi.python.org/pypi/django-siteprefs.. image:: https://img.shields.io/coveralls/idlesign/django-siteprefs/master.svg
:target: https://coveralls.io/r/idlesign/django-siteprefsWhat's that
-----------*django-siteprefs allows Django applications settings to come alive*
Let's suppose you have your pretty settings.py file with you application:
.. code-block:: python
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:
.. code-block:: python
# 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 ;)
Documentation
-------------http://django-siteprefs.readthedocs.org/