Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Magically editable settings for winged pony lovers

Project description

# django-setmagic

Magically editable settings for winged pony lovers.

## Why?

Because sometimes it's cool to set global configuration values through a nice
interface on the Django admin. And that's what SetMagic make possible. Enjoy!

## Install and set up

Install it into your project's virtual environment:

$ pip install django-setmagic

Make sure you already have the [Django admin][1] set up! Then append to your
Django project's `INSTALLED_APPS` setting.


Also enable the SetMagic template context processor, if you want to use it on
your templates, by adding it to the `TEMPLATE_CONTEXT_PROCESSORS` list:


Create the necessary tables, like usual:

$ python syncdb

...and that's pretty much it. :)

## Usage

SetMagic will look into your project's settings for the name `SETMAGIC_SCHEMA`.
It should be defined as a pure Python list of groups like the example below:

('Facebook App Credentials', [
label=u'Facebook app ID',
help_text=u'Unique app identification code provided by Facebook.'),
label=u'Facebook API secret',
help_text=u'Unique and secret API code provided by Facebook.'),
('Tracking', [
label=u'Google Analytics code',
help_text=u'Domain to identify this site through the GA API.'),

From now on, you should be able to set values for your configurations through
the Django admin. And you will, of course, be able to set and retrieve these
values on your code.

from setmagic import settings

# Instantly save onto the database!
settings.FACEBOOK_APP_ID = '000000000000000'

# Retrieve the setting value from the database

# Deletes it from the database
del settings.FACEBOOK_APP_ID

If you added the template context processor like described above, you can also
use SetMagic values on your templates.

<p>My Facebook app ID is <code>{{ setmagic.FACEBOOK_APP_ID }}</code></p>

See? No mistery. :)

## Platform support

* Python 2.6+
* Python 3.x
* Django 1.5+

## Contribute

You can play with the code at SetMagic's reposity on [GitHub][2] or [donate][3]
me a few bucks from heart so I can write open source code without worrying too
much about bills.


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-setmagic, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size django-setmagic-0.3.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page