Stand With Ukraine

Code style: black

Django Content Settings

Django Content Settings - the most advanced admin editable setting

▶️ YouTube Video with dive deep ~ 2h

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.

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. Flaxable permission model: Every setting can have own permission rule for view, edit, fetch in API and view changes history.
  4. Preview: Preview setting before apply and addition option to preview setting change right on site.
  5. Caching System: Ensures high performance, negating the impact of variable complexity on code execution speed.

Additional Admin Panel Functionalities

  • Change History: Track and review the history of changes made to the variables.
  • Preview System: Preview changes for different variable types before finalizing them.
  • Bulk Editing: Facilitate the simultaneous editing of multiple variable types.
  • Permission System: Control edit permissions for enhanced security and management.

API Integration

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

  • Reading of Individual or Group Variables: Allows for flexible data retrieval.
  • Access Permissions: Manage who can read the variables, ensuring data privacy and security.

How does it look

  • Setup. Here you can get step-by-step instruction.

  • Define the setting. To do so you need to define constant in in your app


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.

  • Migrate. In order to be able to edit data in Django Admin
$ python migrate

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

  • Use it in your project. That is it. You can the variable TITLE in your code.

from content_settings.conf import content_settings


or use object settings that unites content settings and django settings in one place

from content_settings.conf import settings


In template:


if you want to use {{SETTINGS}} as an object that unites settings and content settings, replace "content_settings.context_processors.content_settings" with "content_settings.context_processors.settings"


$ curl

Ok, I lied, in order to use in API you need to update permission from the setting:


from content_settings.types.basic import SimpleString
from content_settings import permissions

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

Simple as that, we have a lot of types for settings you can use SimpleText, SimpleHTML, SimpleInt, SimpleBool, SimpleDecimal, DateTimeString, SimpleTimedelta, SimpleYAML, SimpleJSON, SimpleCSV, DjangoTemplate, DjangoModelTemplate, SimpleEval, SimpleExec and so on... Read more about the types available for you.

It is also very fast thanks to our caching system. Read more about it.

Some fancy things you can find in our cookbook.