Home

Awesome

Stand With Ukraine

Django Content Settings - the most advanced admin editable setting

Django Content Settings

Overview

📖 Full documentation

The django-content-settings module is a versatile addition to the Django ecosystem, offering users the ability to easily create and manage editable variables directly from the Django admin panel. What sets this module apart is its ability to handle variables of any type without restricting their complexity. Thanks to an integrated caching system, these variables can be used efficiently in code, irrespective of their complexity.

Preview Edit Settings

Key Features

  1. Type-Agnostic Variable Creation: Users can create variables of any type, making the module highly adaptable to various needs.
  2. Editability from Django Admin Panel: Seamless integration with the Django admin panel allows for effortless editing of variables.
  3. Flexible permission model: Every setting can have its own permission rule for viewing, editing, fetching in API, and viewing changes history.
  4. Preview: Preview the setting before applying and the option to preview the setting changes right on site.
  5. Caching System: Ensures high performance, negating the impact of variable complexity on code execution speed.
  6. Export & Import: Massively dump configuration into a file and massively load configuration from the file using UI or/and commands.

Additional Admin Panel Functionalities

API Integration

The module comes with a built-in API system, enabling:

For the full documentation, please visit here.

How does it look

# content_settings.py

from content_settings.types.basic import SimpleString

TITLE = SimpleString("Songs", help="The title of the site")

the code above defines a variable TITLE, with type SimpleString and default value Songs.

$ python manage.py migrate

Technically, you can use variable in code even without migration. The migration is need to make variable editable in admin panel


from content_settings.conf import content_settings

content_settings.TITLE

In template:

<h2>{{CONTENT_SETTINGS.TITLE}}</h2>

### Quick Look

You should be able to quickly see how it works using `cs_test` project in the [repository](https://github.com/occipital/django-content-settings/t). You need to have [poetry](https://python-poetry.org/) installed.

```bash

$ git clone https://github.com/occipital/django-content-settings.git
$ cd django-content-settings
$ make init
$ make cs-test-migrate
$ make cs-test

the open http://localhost:8000/admin/ in your browser and you should see the django admin panel.

the admin user is admin with password 1.

Whats next?