{ "info": { "author": "Ilya Semenov", "author_email": "ilya@semenov.co", "bugtrack_url": null, "classifiers": [], "description": "django-modelsettings\n====================\n\nThis Django application allows to define Django application settings with Django ORM models and edit them in the admin area.\n\nPlease check the other alternatives at https://www.djangopackages.com/grids/g/live-setting/.\nThis project started because I tried them all and I was not really happy with any of them.\n\n\nKey points\n----------\n\n1. The settings are stored in the database, in normalized tables with proper field types and constraints. In particular, it is possible to have a setting which is a ForeignKey to another model (e.g. \"Default account\"), and it will properly validate and/or update when the corresponding model is deleted.\n\n2. The settings are described using standard Django ORM classes (like ``EmailField`` or ``SmallPositiveIntegerField``) with all the bells and whistles (e.g. validators). There is no parallel hierarchy of classes for different types of data.\n\n3. Each application may have any number of settings groups, however there is no fancy and complex syntax for that. The developer may simply add more ``Settings`` classes if he decides so.\n\n4. The settings are lazy and effective. The database is not hit until the settings are actually accessed, and then it takes exactly one SQL query to fetch all settings for all apps.\n\n5. The system behaves correctly when there is no corresponding data in the database (if the settings have never been saved yet, or have been saved partly).\n\n6. Programmatically, all settings from all application are accessible via a single object.\n\n7. There is a page for Django Admin.\n\n\nRequirements\n============\n\nThe latest version supports Django 1.7-1.9.\n\n\nInstallation\n============\n\n::\n\n\tpip install django-modelsettings\n\n\nMigration from 0.1.x\n--------------------\n\ndjango-modelsettings 0.1.x had a different API and supported Django 1.4-1.8. To migrate from 0.1.x, run ``manage.py migrate dbsettings --fake``.\n\n\nUsage\n=====\n\nAdd ``dbsettings`` to ``INSTALLED_APPS``:\n\n.. code:: python\n\n\t# settings.py\n\n\tINSTALLED_APPS = [\n\t\t...\n\t\t'dbsettings',\n\t]\n\n\nAdd ``Settings`` class in your application:\n\n.. code:: python\n\n\t# blog/models.py\n\n\tfrom dbsettings.models import AppSettings\n\n\tclass Settings(AppSettings):\n\t\tcontact_email = models.EmailField(default=\"info@localhost\")\n\t\tupdate_interval = models.PositiveIntegerField(null=True, default=10, help_text=\"Update interval in seconds\")\n\t\tfacebook_app_id = models.CharField(\"Facebook App ID\", max_length=32, blank=True)\n\n\nCreate the corresponding database tables:\n\n.. code:: bash\n\n\t./manage.py makemigrations && ./manage.py migrate\n\n\nIn your business logic code, access settings via ``django.conf.settings.db``:\n\n.. code:: python\n\n\tfrom django.conf import settings\n\n\tprint(settings.db.blog.contact_email)\n\n\tsettings.db.blog.update_interval = 60\n\tsettings.db.blog.save()\n\n\nor directly:\n\n.. code:: python\n\n\tfrom dbsettings import settings\n\n\tprint(settings.blog.contact_email)\n\n\tsettings.blog.update_interval = 60\n\tsettings.blog.save()\n\n\tprint(settings.django.SECRET_KEY) # shortcut to django.conf.settings\n\n\nAdmin area\n----------\n\nThe settings editor will be automatically added at Django Admin > Settings.\n\nYou can also add a direct link (e.g. in your ``admin/base_site.html`` overrides):\n\n.. code:: django\n\n\t{% trans \"Settings\" %}\n\n\nCustomizing admin area form\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo provide a custom admin form for your settings model, create a ``ModelAdmin`` class and register it:\n\n.. code:: python\n\n\t# blog/admin.py\n\n\tfrom blog.models import Settings\n\tfrom dbsettings.admin import RootSettingsAdmin\n\n\t@RootSettingsAdmin.register(Settings)\n\tclass SettingsAdmin(admin.ModelAdmin):\n\t\tdef formfield_for_dbfield(self, db_field, **kwargs):\n\t\t\tif db_field.name == 'welcome_text':\n\t\t\t\tkwargs['widget'] = SummernoteWidget()\n\t\t\treturn super().formfield_for_dbfield(db_field, **kwargs)\n\n\nSeveral groups of settings per application\n------------------------------------------\n\nIt is possible to split settings into several groups within one application.\n\n.. code:: python\n\n\t# blog/models.py\n\n\tfrom dbsettings.models import AppSettings\n\n\tclass Settings(AppSettings):\n\t\toption1 = models.IntegerField()\n\n\tclass Foo(AppSettings):\n\t\toption2 = models.IntegerField()\n\n\tclass Bar(AppSettings):\n\t\toption3 = models.IntegerField()\n\n\n.. code:: python\n\n\tfrom dbsettings import settings\n\n\tprint(settings.blog.option1)\n\tprint(settings.blog_foo.option2)\n\tprint(settings.blog_bar.option3)", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/IlyaSemenov/django-modelsettings", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-modelsettings", "package_url": "https://pypi.org/project/django-modelsettings/", "platform": "", "project_url": "https://pypi.org/project/django-modelsettings/", "project_urls": { "Homepage": "https://github.com/IlyaSemenov/django-modelsettings" }, "release_url": "https://pypi.org/project/django-modelsettings/0.5.1/", "requires_dist": null, "requires_python": "", "summary": "Define Django application settings with Django ORM models and edit them in the admin area.", "version": "0.5.1" }, "last_serial": 5293258, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e8422dbb18be5260f3b1d9bfa22fda03", "sha256": "43b35b0357a7b99b45c405b53a8b000a4363639e896eac1de3e933de23ea8647" }, "downloads": -1, "filename": "django-modelsettings-0.1.tar.gz", "has_sig": false, "md5_digest": "e8422dbb18be5260f3b1d9bfa22fda03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3006, "upload_time": "2013-08-29T08:32:33", "url": "https://files.pythonhosted.org/packages/ea/d4/14f134d260cbb74e23a088081338c70beabf48ecd757a186bdb9eb291aad/django-modelsettings-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e29e59850d2717d255f03cfebfc14aa2", "sha256": "b67a256b5ed7ab19a0852830124d4bfe5fa9c5e3cf9c062095e4f2509c5cc764" }, "downloads": -1, "filename": "django-modelsettings-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e29e59850d2717d255f03cfebfc14aa2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3019, "upload_time": "2013-08-29T13:36:30", "url": "https://files.pythonhosted.org/packages/64/7e/ad107f1280f0a591d7efa27c96f01c24c2accf5be69cf97d7adfb2c8d2d3/django-modelsettings-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "b96d08349cdcaa6ccef2876179eefc9d", "sha256": "531e9a063e17882c403279cc69a168023c86c1042ab0f7b3c064aa3a5c1851aa" }, "downloads": -1, "filename": "django-modelsettings-0.1.2.tar.gz", "has_sig": false, "md5_digest": "b96d08349cdcaa6ccef2876179eefc9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3718, "upload_time": "2013-10-02T05:02:08", "url": "https://files.pythonhosted.org/packages/60/22/42b08e4e9d72074af7d4bb9dab59d3e58a55ee2362c9586a12f20acb8b3f/django-modelsettings-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "e1c0498441bbe1a69343ddec3ecb828c", "sha256": "8b3e3f4625ed00ca723b9cc911e74e2b46d7a117f55d7d07d51034359c8b97a5" }, "downloads": -1, "filename": "django-modelsettings-0.1.3.tar.gz", "has_sig": false, "md5_digest": "e1c0498441bbe1a69343ddec3ecb828c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3882, "upload_time": "2013-11-18T10:25:07", "url": "https://files.pythonhosted.org/packages/28/27/5f4ac1368a2922c016a5f4e74d0df2035e13573b8af13ca640ed05063f68/django-modelsettings-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "ca0a0d9292debeea2a0c903e082f161b", "sha256": "a683b98c5e038897c70c51727b48a147ac483cbcd3573cad1a20e89f1099a1c2" }, "downloads": -1, "filename": "django-modelsettings-0.1.4.tar.gz", "has_sig": false, "md5_digest": "ca0a0d9292debeea2a0c903e082f161b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3875, "upload_time": "2014-07-15T14:16:35", "url": "https://files.pythonhosted.org/packages/38/58/2f57bd9191b772844e33fa3ae2f5664fdb0a2c987cf5b0a60791d5d9c14a/django-modelsettings-0.1.4.tar.gz" }, { "comment_text": "", "digests": { "md5": "f740cefc905b39721081fd76d5b7525e", "sha256": "f789556e688d5400c413112e1445d292731d9bef226ad924dee9a23c981555f4" }, "downloads": -1, "filename": "django-modelsettings-0.1.4.zip", "has_sig": false, "md5_digest": "f740cefc905b39721081fd76d5b7525e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6332, "upload_time": "2014-01-21T22:57:07", "url": "https://files.pythonhosted.org/packages/4b/f4/dc70eb23c0d497053f5bb93947ffc58c073d5b4f5315a048ab816b733101/django-modelsettings-0.1.4.zip" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "f9ca6c2b80d2f42443c19f8ba29866d1", "sha256": "22f783f01f620ee2d20f2147127ada4f517b2d94cd7b3298b1e6b7066cc81037" }, "downloads": -1, "filename": "django-modelsettings-0.1.5.tar.gz", "has_sig": false, "md5_digest": "f9ca6c2b80d2f42443c19f8ba29866d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3871, "upload_time": "2014-07-15T14:25:52", "url": "https://files.pythonhosted.org/packages/41/89/429f838d617e1ee58f5018c467bc904bf6cf923ffdef60d08f7652bf252b/django-modelsettings-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "ac000e7ad6b4b4103efb9775c7b808e9", "sha256": "f1a03d0dc25c50f6ed5a786c28f1fb461c5d837c0bcb32b3c682f4e8bc700f79" }, "downloads": -1, "filename": "django-modelsettings-0.1.6.tar.gz", "has_sig": false, "md5_digest": "ac000e7ad6b4b4103efb9775c7b808e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4122, "upload_time": "2015-05-25T19:08:32", "url": "https://files.pythonhosted.org/packages/92/e1/d9cb0e8682fc037400e5e6e25c6670c3afbf8feecc41ac13d4bfafaddfb5/django-modelsettings-0.1.6.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "0059b679e256eaf1e5f1ca3486069c77", "sha256": "778773de4aee038e55ba3a1eec995d8c12d0913db93cbc6a4a2c1276dc6d564a" }, "downloads": -1, "filename": "django-modelsettings-0.2.0.tar.gz", "has_sig": false, "md5_digest": "0059b679e256eaf1e5f1ca3486069c77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5099, "upload_time": "2016-08-03T16:07:45", "url": "https://files.pythonhosted.org/packages/d1/70/457c38a00238f00cfbbc39a2a0354104f1ba4b75cdf557ca0c6d34ebaff2/django-modelsettings-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "8a84e931b9363f185bfacfe0b3af97c8", "sha256": "8bcf599c24331a5cc1f1f86b7460b9e0afd842a80fb45ea9113479ead269ade7" }, "downloads": -1, "filename": "django-modelsettings-0.2.1.tar.gz", "has_sig": false, "md5_digest": "8a84e931b9363f185bfacfe0b3af97c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5124, "upload_time": "2016-08-03T16:50:39", "url": "https://files.pythonhosted.org/packages/95/c0/73c15cc6debf62ac86bf857b501f68fe66a30bb5dcacb38cf796f4645646/django-modelsettings-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "be92f1aaa0de1126c627571a7ce1ef55", "sha256": "5219af71dfbd666efd7a37da96ed9560321f5dd7be438f4b19367c23139f5ceb" }, "downloads": -1, "filename": "django-modelsettings-0.2.2.tar.gz", "has_sig": false, "md5_digest": "be92f1aaa0de1126c627571a7ce1ef55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5202, "upload_time": "2016-08-03T16:55:54", "url": "https://files.pythonhosted.org/packages/9b/64/3b014e214cadc8c70b67572fa3aa48d7bde424fff29b7edd4ea3e0d3774f/django-modelsettings-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "900d0cbe3e8d8179a30122e149a63484", "sha256": "2ecd6c0e9457ac4f86e827eea5b5ead06493b06600335fbd8af8806d8ceccfb4" }, "downloads": -1, "filename": "django-modelsettings-0.2.3.tar.gz", "has_sig": false, "md5_digest": "900d0cbe3e8d8179a30122e149a63484", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5251, "upload_time": "2016-08-04T02:31:20", "url": "https://files.pythonhosted.org/packages/c4/66/c9351b6fd963a0c1c6c69e2456a0fc59c68f15e307c87facc86e848e4f95/django-modelsettings-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "87f04d1089cf8dfa0c36acb86b8fecd0", "sha256": "c43f250750bce1f461c36705ad9e2d594995175c145d7e38123cb1351193a8e6" }, "downloads": -1, "filename": "django-modelsettings-0.3.0.tar.gz", "has_sig": false, "md5_digest": "87f04d1089cf8dfa0c36acb86b8fecd0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5022, "upload_time": "2016-08-04T05:26:32", "url": "https://files.pythonhosted.org/packages/e2/06/791b1b0d829be31156196cf23bbdcc86a319034601b9960d68b24e3acd45/django-modelsettings-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "ae1241fbcd530ffb76deedba1f94a4e3", "sha256": "0df5f53773612f0e3b3b7bd2a098d67ec6556ae9820fb53e241ccb9b4105cfdd" }, "downloads": -1, "filename": "django-modelsettings-0.3.1.tar.gz", "has_sig": false, "md5_digest": "ae1241fbcd530ffb76deedba1f94a4e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5050, "upload_time": "2016-08-05T03:24:42", "url": "https://files.pythonhosted.org/packages/af/c3/d82f8e43f96b149000a7927cb87f3f35ec99110f3486547ad03b07763e03/django-modelsettings-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "1e0b88c6498b56d16849a97faba8d0d9", "sha256": "a7c13c22085ad9d8ce748547ba4d73f12b4cd4690db879cee1c0c5bc9aa2cdc5" }, "downloads": -1, "filename": "django-modelsettings-0.3.2.tar.gz", "has_sig": false, "md5_digest": "1e0b88c6498b56d16849a97faba8d0d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5333, "upload_time": "2016-08-05T10:45:44", "url": "https://files.pythonhosted.org/packages/a5/c5/3873131ca68f524d0957385cb7eec4202bca2089585b7993cc29e2ef8b4f/django-modelsettings-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "9ff5d79034f9b1843d21f7e16bf1d5a1", "sha256": "b4854a4e1c956f9b7ac77acfbb29d23f2edbc04d19d1bf2cdb91fd470288db27" }, "downloads": -1, "filename": "django-modelsettings-0.3.3.tar.gz", "has_sig": false, "md5_digest": "9ff5d79034f9b1843d21f7e16bf1d5a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5339, "upload_time": "2016-08-05T10:52:57", "url": "https://files.pythonhosted.org/packages/a3/b9/324221af5bf9bf5e0716716d1ee69065463436fe06c36577ebf550769e71/django-modelsettings-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "81eb2eb3f01687065ad18328d148ce92", "sha256": "a0a4d47f017bb1223ebf61fb04a07cd24e597691fd16fe5b04c90fc944f8a300" }, "downloads": -1, "filename": "django-modelsettings-0.3.4.tar.gz", "has_sig": false, "md5_digest": "81eb2eb3f01687065ad18328d148ce92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5352, "upload_time": "2016-08-05T11:12:38", "url": "https://files.pythonhosted.org/packages/fb/6b/b4aa0969527adfcb5c30af96de19efa2e67cf1a47be175ce8dfe9c7d5a25/django-modelsettings-0.3.4.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "227bec2e43ed4271a589c94ce9f4ad87", "sha256": "cec5918f0fda11eecfbf47a76ea48f4e87b0a1e5d304a7ef02973ce2d5c727a0" }, "downloads": -1, "filename": "django-modelsettings-0.4.0.tar.gz", "has_sig": false, "md5_digest": "227bec2e43ed4271a589c94ce9f4ad87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5555, "upload_time": "2016-11-21T07:20:35", "url": "https://files.pythonhosted.org/packages/90/3c/82e8e4cd386b56845dafb21e726ee55c955f4153efc124006a93e850695a/django-modelsettings-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "2552982f832b518f1a5967a2f31027c0", "sha256": "2612dfb1428e046900b6c9bbd0bf30beb8d59a04b26fbd1cab5abfaea05bcb7d" }, "downloads": -1, "filename": "django-modelsettings-0.5.0.tar.gz", "has_sig": false, "md5_digest": "2552982f832b518f1a5967a2f31027c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5955, "upload_time": "2016-11-21T09:25:40", "url": "https://files.pythonhosted.org/packages/41/cd/65955cbfba8772ac8450cf1aa24dcf1c2ac6c07f357a2e70456da3497603/django-modelsettings-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "c898ed0d7a3ae599b729ddb9d38a952a", "sha256": "a536897a27c45f47742aadc2253e6937daede22441d2d4eb7aa2380b9665e6ad" }, "downloads": -1, "filename": "django-modelsettings-0.5.1.tar.gz", "has_sig": false, "md5_digest": "c898ed0d7a3ae599b729ddb9d38a952a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6003, "upload_time": "2019-05-20T16:36:21", "url": "https://files.pythonhosted.org/packages/82/9e/c23c5a2fcb4c7e5b017f9e42b03645d8b3486567e3c88ba6dc4373c320dc/django-modelsettings-0.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c898ed0d7a3ae599b729ddb9d38a952a", "sha256": "a536897a27c45f47742aadc2253e6937daede22441d2d4eb7aa2380b9665e6ad" }, "downloads": -1, "filename": "django-modelsettings-0.5.1.tar.gz", "has_sig": false, "md5_digest": "c898ed0d7a3ae599b729ddb9d38a952a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6003, "upload_time": "2019-05-20T16:36:21", "url": "https://files.pythonhosted.org/packages/82/9e/c23c5a2fcb4c7e5b017f9e42b03645d8b3486567e3c88ba6dc4373c320dc/django-modelsettings-0.5.1.tar.gz" } ] }