{
"info": {
"author": "Mishbah Razzaque",
"author_email": "mishbahx@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3"
],
"description": "=============================\ndjango-usersettings2\n=============================\n\n.. image:: http://img.shields.io/travis/mishbahr/django-usersettings2.svg?style=flat-square\n :target: https://travis-ci.org/mishbahr/django-usersettings2/\n\n.. image:: http://img.shields.io/pypi/v/django-usersettings2.svg?style=flat-square\n :target: https://pypi.python.org/pypi/django-usersettings2/\n :alt: Latest Version\n\n.. image:: http://img.shields.io/pypi/l/django-usersettings2.svg?style=flat-square\n :target: https://pypi.python.org/pypi/django-usersettings2/\n :alt: License\n\n.. image:: http://img.shields.io/coveralls/mishbahr/django-usersettings2.svg?style=flat-square\n :target: https://coveralls.io/r/mishbahr/django-usersettings2?branch=master\n\n\nA reusable app for django, provides the ability to configure site settings via the admin interface, rather than by editing settings.py\n\n\nWhy would you use usersettings?\n-------------------------------\n\nThis project is the missing extension to the Django \u201csites\u201d framework, use it to store additional information for your Django-powered sites. The project structure is heavily inspired by django ``sites`` app, with a ``one-to-one`` relationship to the ``Site`` model.\n\nIt\u2019s best explained through examples.\n\n\nExample Usage\n-------------\n\nFor example, suppose you\u2019re developing a multi-site django project i.e. using single Django installation that powers more than one site and you need to differentiate between those sites in some way.\n\n(e.g. Site Title, Physical Location, Contact Details... etc)\n\nOf course, you could hardcode the information in the templates and use different templates\nfor each site. Alternatively you could configure details in your `settings.py` for each site.\n\nA better solution would be to use ``django-usersettings2``. This project accomplishes several things quite nicely:\n\n* It lets the site producers edit all settings \u2013 for multiple sites \u2013 in a single interface (the Django admin).\n* It lets the site developers use the same Django views/templates for multiple sites.\n\nTo get started, create a class that inherits from ``usersettings.models.UserSettings``. Make sure to import the ``UserSettings`` model. Your class should live in one of your apps\u2019 models.py (or module).\n\nSince ``UserSettings`` model inherit from ``django.db.models.Model``, you are free to add any field you want.\n\nHere's a simple example:\n\n.. code-block:: python\n\n from django.db import models\n from django.utils.translation import ugettext_lazy as _\n\n from usersettings.models import UserSettings\n\n class SiteSettings(UserSettings):\n site_title = models.CharField(_('Site Title'), max_length=100)\n tag_line = models.CharField(_('Tag Line'), max_length=150, blank=True)\n site_description = models.TextField(_('Site Description'), blank=True)\n\n ...\n\n class Meta:\n verbose_name = 'Site Settings'\n verbose_name_plural = 'Site Settings'\n\nIf you followed the Django tutorial, this shouldn\u2019t look too new to you.\nThe only difference to normal models is that you subclass ``usersettings.models.UserSettings`` rather than ``django.db.models.base.Model``.\n\nHooking the 'usersettings' to the admin site\n--------------------------------------------\n\nTo make your new model editable in the admin interface, you must first create an admin class that subclasses ``usersettings.admin.SettingsAdmin``. Continuing with the example model above, here\u2019s a simple corresponding ``SiteSettingsAdmin`` class:\n\n.. code-block:: python\n\n from django.contrib import admin\n from django.utils.translation import ugettext_lazy as _\n\n from usersettings.admin import SettingsAdmin\n\n from .models import SiteSettings\n\n\n class SiteSettingsAdmin(SettingsAdmin):\n\n fieldsets = (\n (_('Site Title / Tag Line'), {\n 'description': '...',\n 'fields': ('site_title', 'tag_line',)\n }),\n ...\n )\n\n ...\n\n admin.site.register(SiteSettings, SiteSettingsAdmin)\n\n\nSince ``SettingsAdmin`` inherits from ModelAdmin, you\u2019ll be able to use the normal\nset of Django ModelAdmin properties, as appropriate to your circumstance.\n\nOnce you\u2019ve registered your admin class, a new model will appear in the top-level admin list.\n\n\nHooking into the current usersettings from views\n------------------------------------------------\n\nYou can use the ``usersettings`` in your Django views to do particular things based on the ``usersettings`` for the site.\n\nHere\u2019s an example of what the a view looks like:\n\n.. code-block:: python\n\n from usersettings.shortcuts import get_current_usersettings\n\n def home(request):\n ...\n\n current_usersetting = get_current_usersettings()\n\n context = {\n 'title': current_usersetting.site_title,\n }\n\n ...\n\nCustom Middleware\n-----------------\n\nTo avoid the repetitions of having to import ``current_usersetting`` for every view. Add ``usersettings.middleware.CurrentUserSettingsMiddleware`` to ``MIDDLEWARE_CLASSES``\nThe middleware sets the ``usersettings`` attribute on every request object, so you can use ``request.usersettings`` to get the current usersettings:\n\n.. code-block:: python\n\n MIDDLEWARE_CLASSES = (\n ...\n 'usersettings.middleware.CurrentUserSettingsMiddleware',\n ...\n )\n\nCaching the current ``UserSettings`` object\n-------------------------------------------\nAs the ``usersettings`` are stored in the database, each call to ``UserSettings.objects.get_current()`` could result in a database query.\n\nBut just like the Django sites framework, on the first request the current usersettings is cached, and any subsequent call returns the cached data instead of hitting the database.\n\nIf for any reason you want to force a database query, you can tell Django to clear the cache using ``UserSettings.objects.clear_cache()``:\n\n.. code-block:: python\n\n from usersettings.shortcuts import get_usersettings_model\n \n UserSettings = get_usersettings_model()\n \n # First call; current usersettings fetched from database.\n current_usersetting = UserSettings.objects.get_current()\n\n # Second call; current usersettings fetched from cache.\n current_usersetting = UserSettings.objects.get_current()\n\n # Force a database query for the third call.\n UserSettings.objects.clear_cache()\n current_usersetting = UserSettings.objects.get_current()\n\nInstall\n-------\n\n1. Install ``django-usersettings``:\n\n .. code-block:: bash\n\n pip install django-usersettings2\n\n2. Add ``usersettings`` to ``INSTALLED_APPS``:\n\n .. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'usersettings',\n ...\n )\n\n3. Specify the custom ``UserSettings`` model as the default usersettings model for your project using the ``USERSETTINGS_MODEL`` setting in your settings.py (required):\n\n .. code-block:: python\n\n USERSETTINGS_MODEL = 'config.SiteSettings'\n\n4. Add ``usersettings.middleware.CurrentUserSettingsMiddleware`` to ``MIDDLEWARE_CLASSES`` (optional).\n\n The middleware sets the ``usersettings`` attribute on every request object, so you can use ``request.usersettings`` to get the current usersettings:\n\n .. code-block:: python\n\n MIDDLEWARE_CLASSES = (\n ...\n 'usersettings.middleware.CurrentUserSettingsMiddleware',\n ...\n )\n\n5. The current usersettings are made available in the template context when your ``TEMPLATE_CONTEXT_PROCESSORS`` setting contains ``usersettings.context_processors.usersettings``:\n\n .. code-block:: python\n\n TEMPLATE_CONTEXT_PROCESSORS = (\n ...\n 'usersettings.context_processors.usersettings',\n ...\n )\n\n\nDependencies\n------------\n\ndjango-usersettings2 requires The `sites `_\nframework to be installed.\n\nTo enable the sites framework, follow these steps:\n\n1. Add `django.contrib.sites` to your ``INSTALLED_APPS`` setting:\n\n .. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'django.contrib.sites'\n ...\n )\n\n2. Define a ``SITE_ID`` setting:\n\n .. code-block:: python\n\n SITE_ID = 1\n\n3. Run migrate.\n\n\nDJANGO-CMS >= 3.0 Toolbar\n--------------------------\n\n`djangocms-usersettings2 `_ integrates ``django-usersettings2`` with `django-cms>=3.0 `_\n\nThis allows a site editor to add/modify all usersettings in the frontend editing mode of django CMS and provide your users with a streamlined editing experience.\n\n\nDocumentation\n-------------\n\nThe full documentation is at https://django-usersettings2.readthedocs.org.\n\n\n\n\nHistory\n-------\n\n0.1.0 (2014-09-05)\n++++++++++++++++++\n\n* First release on PyPI.\n",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/mishbahr/django-usersettings2",
"keywords": "django-usersettings2",
"license": "BSD",
"maintainer": "",
"maintainer_email": "",
"name": "django-usersettings2",
"package_url": "https://pypi.org/project/django-usersettings2/",
"platform": "",
"project_url": "https://pypi.org/project/django-usersettings2/",
"project_urls": {
"Homepage": "https://github.com/mishbahr/django-usersettings2"
},
"release_url": "https://pypi.org/project/django-usersettings2/0.1.6/",
"requires_dist": null,
"requires_python": "",
"summary": "The missing extension to the Django \u201csites\u201d framework, use it to store additional information for your Django-powered sites.",
"version": "0.1.6"
},
"last_serial": 3609863,
"releases": {
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "8806c5b677cb33ad841f4443c1d1ab9f",
"sha256": "68876fe506787e0f73cddd9fe0aa56498dad8900082dc5b6f02e32a3181f1533"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "8806c5b677cb33ad841f4443c1d1ab9f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11685,
"upload_time": "2014-09-05T22:25:40",
"url": "https://files.pythonhosted.org/packages/e5/1a/c1638449914e15b308d3af2d4ddcc6d0b578c6be8a3c273d0aa258862450/django-usersettings2-0.1.0.tar.gz"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "837c1219d9e2fc150a752e3df2a757a4",
"sha256": "338fe93a651357d0448f2a5a1d08067629b5a4f2a05d450780f346b4117854e8"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "837c1219d9e2fc150a752e3df2a757a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11064,
"upload_time": "2014-09-06T22:05:31",
"url": "https://files.pythonhosted.org/packages/9c/b9/36923acdae2214eda6d22578c60fcdd890ddf5df275c6533a0002379fb6a/django-usersettings2-0.1.1.tar.gz"
}
],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "0850101a446de686b6171f458226f2d6",
"sha256": "58ab21176dea4739bd7fec917d8d80ce90395dcd39ba13aa5c4e855e8ae63efe"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "0850101a446de686b6171f458226f2d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10907,
"upload_time": "2014-09-14T01:18:18",
"url": "https://files.pythonhosted.org/packages/27/ff/c5f570215071e8138260bbe46c8953ae2d9c662ba96c6ae7b80227cd2202/django-usersettings2-0.1.2.tar.gz"
}
],
"0.1.3": [
{
"comment_text": "",
"digests": {
"md5": "b17740051c503da3d96eb53fbc129150",
"sha256": "ffc3630978d078f933b3849a61eecdec9515659c50190e17284043b27f00a5bd"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "b17740051c503da3d96eb53fbc129150",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10933,
"upload_time": "2014-09-25T23:30:30",
"url": "https://files.pythonhosted.org/packages/26/1a/09b436a06ef77cb1dac6f9ea3b28dbf50b2b90167337ba694233d404641e/django-usersettings2-0.1.3.tar.gz"
}
],
"0.1.4": [
{
"comment_text": "",
"digests": {
"md5": "8e94c7af55fe7ec279c56d55748c0694",
"sha256": "929d9ee89b4286804f2bf70319fd6331dcff5dbae1c0c43c1c55d1fbd26b0e45"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "8e94c7af55fe7ec279c56d55748c0694",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11224,
"upload_time": "2015-05-26T11:18:52",
"url": "https://files.pythonhosted.org/packages/e8/9e/93f01e059d5a03c2c91eb57326c83269e651f060504c5d3f4da2167167f0/django-usersettings2-0.1.4.tar.gz"
}
],
"0.1.5": [
{
"comment_text": "",
"digests": {
"md5": "56f4c7d6e8db8dcd96cb9960045e6654",
"sha256": "40c91098999e47237414137fb1e53e2c66b7565034da900e6b04704d4a13ca66"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "56f4c7d6e8db8dcd96cb9960045e6654",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11194,
"upload_time": "2015-06-21T20:15:32",
"url": "https://files.pythonhosted.org/packages/98/7b/23a9391be14a2d00d2e0f1a5e4f051e4ae625d857f65faefbadfee534f8d/django-usersettings2-0.1.5.tar.gz"
}
],
"0.1.6": [
{
"comment_text": "",
"digests": {
"md5": "5971372ad68577569ca552040daac88c",
"sha256": "4d4fca0c0375e069294f9352de154cba1d4479835da16a191793ab3a0723ce81"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "5971372ad68577569ca552040daac88c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13305,
"upload_time": "2018-02-23T16:50:40",
"url": "https://files.pythonhosted.org/packages/89/7f/5e5ee608c812a9fa4dab0cc982d36b8687bc00e90d53d7c04b6153b4b136/django-usersettings2-0.1.6.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "5971372ad68577569ca552040daac88c",
"sha256": "4d4fca0c0375e069294f9352de154cba1d4479835da16a191793ab3a0723ce81"
},
"downloads": -1,
"filename": "django-usersettings2-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "5971372ad68577569ca552040daac88c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13305,
"upload_time": "2018-02-23T16:50:40",
"url": "https://files.pythonhosted.org/packages/89/7f/5e5ee608c812a9fa4dab0cc982d36b8687bc00e90d53d7c04b6153b4b136/django-usersettings2-0.1.6.tar.gz"
}
]
}