Package: django-config-models
PurposeThis app allows other apps to easily define a configuration model
that can be hooked into the admin site to allow configuration management
with auditing.Getting StartedAddconfig_modelsto yourINSTALLED_APPSlist.UsageCreate a subclass ofConfigurationModel, with fields for each
value that needs to be configured:class MyConfiguration(ConfigurationModel):
    frobble_timeout = IntField(default=10)
    frazzle_target = TextField(defalut="debug")This is a normal django model, so it must be synced and migrated as usual.The default values for the fields in theConfigurationModelwill be
used if no configuration has yet been created.Register that class with the Admin site, using theConfigurationAdminModel:from django.contrib import admin

from config_models.admin import ConfigurationModelAdmin

admin.site.register(MyConfiguration, ConfigurationModelAdmin)Use the configuration in your code:def my_view(self, request):
    config = MyConfiguration.current()
    fire_the_missiles(config.frazzle_target, timeout=config.frobble_timeout)Use the admin site to add new configuration entries. The most recently created
entry is considered to becurrent.ConfigurationThe currentConfigurationModelwill be cached in theconfigurationdjango cache,
or in thedefaultcache ifconfigurationdoesn’t exist. Theconfigurationanddefaultcaches
are specified in the djangoCACHESsetting. The caching can be per-process, per-machine, per-cluster, or
some other strategy, depending on the cache configuration.You can specify the cache timeout in eachConfigurationModelby setting thecache_timeoutproperty.You can change the name of the cache key used by theConfigurationModelby overriding
thecache_key_namefunction.ExtensionConfigurationModelsare just django models, so they can be extended with new fields
and migrated as usual. Newly added fields must have default values and should be nullable,
so that rollbacks to old versions of configuration work correctly.DocumentationThe full documentation is athttps://django-config-models.readthedocs.org.LicenseThe code in this repository is licensed under the AGPL 3.0 unless
otherwise noted.Please seeLICENSE.txtfor details.Getting HelpIf you’re having trouble, we have discussion forums atdiscuss.openedx.orgwhere you can connect with others in the
community.Our real-time conversations are on Slack. You can request aSlack
invitation, then join ourcommunity Slack workspace.For anything non-trivial, the best path is toopen an issuein this
repository with as many details about the issue you are facing as you
can provide.For more information about these options, see theGetting Helppage.How To ContributeContributions are very welcome.Please readHow To Contributefor details.This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to have a discussion about your new feature idea with the maintainers prior to beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.Open edX Code of ConductAll community members are expected to follow theOpen edX Code of Conduct.PeopleThe assigned maintainers for this component and other project details may be
found inBackstage. Backstage pulls this data from thecatalog-info.yamlfile in this repo.Reporting Security IssuesPlease do not report security issues in public. Please emailsecurity@edx.org.Change Log[2.5.1] - 2023-09-22Fixed issues with Django 4.2[2.5.0] - 2023-08-07FixedConfigurationModel.current: it will make sure that it does not return None for current configuration.[2.4.0] - 2023-07-19Added support for Django42 in CISwitch fromedx-sphinx-themetosphinx-book-themesince the former is
deprecated[2.3.0] - 2022-01-19Added Support for Django40 in CIDropped Support for Django22, 30, 31[2.2.2] - 2021-20-12Updated dependencies after removing unnecessary constraint on edx-django-utils, so the constraint will no longer be advertised.[2.2.1] - 2021-20-12Replaced deprecated ‘django.utils.translation.ugettext’ with ‘django.utils.translation.gettext’[2.2.0] - 2021-07-14Added support for django3.2[2.1.2] - 2021-06-24Move out django pin from base.in. Now it is coming from global constraint. Ran make upgrade.[2.1.1] - 2021-01-28Fix deprecated reference ofutil.memcache.safe_key[2.1.0] - 2021-01-12Dropped Python 3.5 Support[2.0.2] - 2020-05-10Fix html escaping of edit links in admin[2.0.1] - 2020-05-08Dropped support for Django<2.2Dropped support for python3.6Added support for python3.8[2.0.0] - 2020-02-06Dropping support for Python 2.7Switch to using edx-django-utils TieredCache (a two-layer cache that uses both
Django’s cache and an internal request-level cache) to reduce the number of
memcached roundtrips. This was a major performance issue that accounted for
10-20% of transaction time for certain courseware views in edx-platform.It is now REQUIRED to addRequestCacheMiddlewareto middlewareto use ConfigModels.Remove usage of the “configuration” cache setting. ConfigModels now always use
the default Django cache.Django Rest Framework 3.7 and 3.8 are no longer supported.[1.0.1] - 2019-04-23Fix auto publishing to PyPI[1.0.0] - 2019-04-23ChangedUnpin django-rest-framework requirements. This is a potentiallybreaking changeif people were
relying on this package to ensure the correct version of djangorestframework was being installed.[0.2.0] - 2018-07-13AddedSupport for Python 3.6RemovedTesting against Django 1.8 - 1.10ChangedUpdated dependency management to follow OEP-18[0.1.10] - 2018-05-21ChangedDon’t assume the user model is Django’s default auth.User[0.1.9] - 2017-08-07ChangedUpdated Django REST Framework dependency to 3.6 as we were not actually compatible with 3.2.[0.1.8] - 2017-06-19AddedSupport for Django 1.11.[0.1.7] - 2017-06-19Unreleased version number[0.1.6] - 2017-06-01AddedSupport for Django 1.10.[0.1.1] - [0.1.5] - 2017-06-01AddedAdd quality testing to travis run.Add encrypted password for package PyPI.RemovedRemove the quality condition on deployment.Remove the version combos known to fail.ChangedAllow for lower versions of djangorestframework, to be compatible with edx-platform.Constrict DRF to version that works.Update versions of requirements via pip-compile.Use different test target - test-all instead of validate.FixedFix name and supported versions.[0.1.0] - 2016-10-06AddedFirst release on PyPI.