Skip to main content

OpenSSF Scorecard

django-extra-settings

config and manage typed extra settings using just the django admin.

Installation

  • Run pip install django-extra-settings
  • Add extra_settings to settings.INSTALLED_APPS
  • Run python manage.py migrate
  • Run python manage.py collectstatic
  • Restart your application server
  • Just go to the admin where you can create, update and delete your settings.

Usage

Settings

All these settings are optional, if not defined in settings.py the default values (listed below) will be used.

# the name of the installed app for registering the extra settings admin.
EXTRA_SETTINGS_ADMIN_APP = "extra_settings"
# the name of the cache to use, if not found the "default" cache will be used.
EXTRA_SETTINGS_CACHE_NAME = "extra_settings"
from extra_settings.choices import SettingType

# a list of settings that will be available by default, each item must contain "name", "type" and "value".
# check the #types section to see all the supported settings types.
EXTRA_SETTINGS_DEFAULTS = [
    {
        "name": "SETTING_NAME",
        "type": SettingType.STRING,
        "value": "Hello World",
    },
    # ...
]
# if True, settings names will be forced to honor the standard django settings format
EXTRA_SETTINGS_ENFORCE_UPPERCASE_SETTINGS = True
# if True, the template tag will fallback to django.conf.settings,
# very useful to retrieve conf settings such as DEBUG.
EXTRA_SETTINGS_FALLBACK_TO_CONF_SETTINGS = True
# the upload_to path value of settings of type 'file'
EXTRA_SETTINGS_FILE_UPLOAD_TO = "files"
# the upload_to path value of settings of type 'image'
EXTRA_SETTINGS_IMAGE_UPLOAD_TO = "images"
# if True, settings name prefix list filter will be shown in the admin changelist
EXTRA_SETTINGS_SHOW_NAME_PREFIX_LIST_FILTER = False
# if True, settings type list filter will be shown in the admin changelist
EXTRA_SETTINGS_SHOW_TYPE_LIST_FILTER = False
# the package name displayed in the admin
EXTRA_SETTINGS_VERBOSE_NAME = "Settings"

Celery

Admin

You can display the settings model admin in another installed app group by using the EXTRA_SETTINGS_ADMIN_APP setting.

You can also have a more advanced control, by registering the settings admin with multiple installed apps and filtering each app settings using the queryset_processor argument.

⚠️ If you do either of the above, you must run migrations for each app that will display extra_settings model admin in its admin (because django creates migrations even for proxy models).

Admin advanced configuration example

In your custom app photos.admin module:

from extra_settings.admin import register_extra_settings_admin

register_extra_settings_admin(
    app=__name__,
    queryset_processor=lambda qs: qs.filter(name__istartswith="PHOTOS_"),
    unregister_default=True,
)

In your custom app videos.admin module:

from extra_settings.admin import register_extra_settings_admin

register_extra_settings_admin(
    app=__name__,
    queryset_processor=lambda qs: qs.filter(name__istartswith="VIDEOS_"),
    unregister_default=True,
)

By default the "extra_settings" app has its own admin app group.

Caching

You can customise the app caching options using settings.CACHES["extra_settings"] setting, otherwise the "default" cache will be used:

CACHES = {
    # ...
    "extra_settings": {
        "BACKEND": "django.core.cache.backends.locmem.LocMemCache",
        "TIMEOUT": 60,
    },
    # ...
}

By default the "extra_settings" cache is used, if you want to use another cache you can set it using the EXTRA_SETTINGS_CACHE_NAME setting.

Python

You can create, read, update and delete settings programmatically:

Types

Setting types are available as a TextChoices enum in extra_settings.choices. Unlike Setting.TYPE_*, it can be imported anywhere (including your settings.py) without triggering AppRegistryNotReady:

from extra_settings.choices import SettingType

SettingType.STRING  # == "string"

This is the list of the currently supported setting types:

  • SettingType.BOOL
  • SettingType.DATE
  • SettingType.DATETIME
  • SettingType.DECIMAL
  • SettingType.DURATION
  • SettingType.EMAIL
  • SettingType.FILE
  • SettingType.FLOAT
  • SettingType.IMAGE
  • SettingType.INT
  • SettingType.JSON
  • SettingType.STRING
  • SettingType.TEXT
  • SettingType.TIME
  • SettingType.URL

The Setting.TYPE_* constants (e.g. Setting.TYPE_STRING) remain available as aliases for backward compatibility.

Create

from extra_settings.models import Setting

setting_obj = Setting(
    name="SETTING_NAME",
    value_type=Setting.TYPE_STRING,
    value="django-extra-settings",
)
setting_obj.save()

Read

from extra_settings.models import Setting

value = Setting.get("SETTING_NAME", default="django-extra-settings")

Update

from extra_settings.models import Setting

setting_obj = Setting(
    name="SETTING_NAME",
    value_type=Setting.TYPE_BOOL,
    value=True,
)
setting_obj.value = False
setting_obj.save()

Delete

from extra_settings.models import Setting

Setting.objects.filter(name="SETTING_NAME").delete()

Validators

You can define a custom validator for each setting:

  • Validators must be defined using full python path, eg. myapp.mymodule.my_validator.
  • Validators are called passing a single argument (the value of the setting) and if the value is valid, they should return True, otherwise returning False or None a ValidationError is raised.

Templates

You can retrieve settings in templates:

{% load extra_settings %}

{% get_setting 'SETTING_NAME' default='django-extra-settings' %}

Tests

You can override specific settings during tests using extra_settings.test.override_settings.

It can be used both as decorator and as context-manager:

from extra_settings.test import override_settings

# decorator
@override_settings(SETTING_NAME_1="value for testing 1", SETTING_NAME_2="value for testing 2")
def test_with_custom_settings(self):
    pass

# context manager
def test_with_custom_settings(self):
    with override_settings(SETTING_NAME_1="value for testing 1", SETTING_NAME_2="value for testing 2"):
        pass

Testing

# clone repository
git clone https://github.com/fabiocaccamo/django-extra-settings.git && cd django-extra-settings

# create virtualenv and activate it
python -m venv venv && . venv/bin/activate

# upgrade pip
python -m pip install --upgrade pip

# install requirements
pip install -r requirements.txt -r requirements-test.txt

# install pre-commit to run formatters and linters
pre-commit install --install-hooks

# run tests
tox
# or
python runtests.py
# or
python -m django test --settings "tests.settings"

License

Released under MIT License.


Supporting

See also

  • django-admin-interface - the default admin interface made customizable by the admin itself. popup windows replaced by modals. 🧙 ⚡

  • django-cache-cleaner - clear the entire cache or individual caches easily using the admin panel or management command. 🧹✨

  • django-colorfield - simple color field for models with a nice color-picker in the admin. 🎨

  • django-email-validators - no more invalid or disposable emails in your database. ✉️ ✅

  • django-maintenance-mode - shows a 503 error page when maintenance-mode is on. 🚧 🛠️

  • django-redirects - redirects with full control. ↪️

  • django-treenode - probably the best abstract model / admin for your tree based stuff. 🌳

  • python-benedict - dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘

  • python-codicefiscale - encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. 🇮🇹 💳

  • python-fontbro - friendly font operations. 🧢

  • python-fsutil - file-system utilities for lazy devs. 🧟‍♂️

Metadata

Release files for django-extra-settings 0.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-extra-settings 0.15.0
File Size Uploaded Provenance
django_extra_settings-0.15.0.tar.gz 23.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-extra-settings 0.15.0
File Interpreter ABI Platform
django_extra_settings-0.15.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.2 kB

Release files / django_extra_settings-0.15.0.tar.gz

Download URL django_extra_settings-0.15.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac14cd6568c206e6c889b5ab9d108a8c6d50bf4cc38b698d63f18948c6294828
BLAKE2b-256 checksum
How to use checksums
9d282d68b11fd508c7dca48518d7e80091b29d6991876a10314774693418085b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

Release files / django_extra_settings-0.15.0-py3-none-any.whl

Download URL django_extra_settings-0.15.0-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ea164dc869fe6ff597b68709619c43c0bc3ea4b1ca67985ba9b38e088527e2b
BLAKE2b-256 checksum
How to use checksums
3761bf08a75b9a58d7fa267c8708a32df88f768165285ff5ef05b6c472636e75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

Security for django-extra-settings 0.15.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_extra_settings-0.15.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page