Skip to main content

Ability to easily create and manage editable variables directly from the Django admin panel

Project description

Django Content Settings - the most advanced admin editable setting

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.

For the full documentation, please visit here.

▶️ YouTube Video with dive deep ~ 2h

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 content_settings.py in your app

# 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.

  • Migrate. In order to be able to edit data in Django Admin
$ 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

  • Use it in your project. That is it. You can the variable TITLE in your code.
from content_settings.conf import content_settings

content_settings.TITLE

In template:

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

In API:

$ curl http://127.0.0.1/content-settings/fetch/title/

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

# content_settings.py

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

TITLE = SimpleString(
    "Songs",
    fetch_permission=permissions.any,
    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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_content_settings-0.11.2.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_content_settings-0.11.2-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file django_content_settings-0.11.2.tar.gz.

File metadata

  • Download URL: django_content_settings-0.11.2.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.11.3 Darwin/23.3.0

File hashes

Hashes for django_content_settings-0.11.2.tar.gz
Algorithm Hash digest
SHA256 f6cefe6d467b57e3e9bbb93304ac130ab8357a89f9b7ac998ce1347f98d13ee6
MD5 b82b5d9e82257eb1a3e159d38d7e4fb4
BLAKE2b-256 bfcafece98d1721d1c383ebea6c75c57729fdd02a633f203690baf758ba3fff8

See more details on using hashes here.

File details

Details for the file django_content_settings-0.11.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_content_settings-0.11.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0342ca19f6ae8b7dde1f94ba66480e51e1963192ff40a91126c1203a717909aa
MD5 2cfb63d544c35f5cb4d77b0c9183e776
BLAKE2b-256 af1d1c48886a5f9c35bbabbb76a23d327505e6f63b5723a4704f336ef7cbab1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page