Skip to main content

Django Content Settings - The Most Advanced Admin Editable Setting

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

For the full documentation, please visit here.

django-content-settings allows you to store variables with specific functionality in your code that can be validated and previewed in your Django admin panel. Validators, previewers, and all associated logic are defined in the setting configuration.

Key Features

  1. Type-Agnostic Variable Creation: Create variables of any type, making the module highly adaptable to diverse needs. Learn more about basic types and template types.
  2. Flexible Permission Model: Define custom permission rules for viewing, editing, fetching in APIs, and viewing the change history of each setting. Learn more about the available API.
  3. Preview Functionality: Preview settings before applying them, with the option to view changes directly on the site.
  4. Export & Import: Export and import configurations in bulk using the UI or command-line tools.
  5. Editability via Django Admin Panel: Seamlessly edit variables directly within the Django admin panel. See how the Django Admin interface looks.
  6. Caching System: Optimized performance ensures variable complexity does not impact execution speed. Learn more about caching and speed optimization.
  7. Extensions: Leverage a wide array of configuration options and extension points. Explore available extensions.

Additional Admin Panel Functionalities

  • Change History: Track and review changes made to variables.
  • Preview System: Preview changes for different variable types before applying them.
  • Bulk Editing: Edit multiple variables simultaneously.
  • Permission System: Implement granular edit permissions for enhanced security and management.
  • Tags Navigation: Organize settings with tags, enabling flexible navigation even with 1,000+ settings in the system.

Learn more about these features here.

How It Works

# 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 the type SimpleString and the default value "Songs".

  • Migrate: Run migrations to enable editing raw values in the Django Admin panel.
$ python manage.py migrate

You can use the setting in your code without running migrations, but migrations are required to make the setting editable in the admin panel.

  • Use It in Your Project: Access the TITLE setting in your code.
from content_settings.conf import content_settings

content_settings.TITLE

In a template:

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

Learn more about accessing settings.

Quick Look

You can quickly explore the functionality using the cs_test project in the repository. Ensure you have Poetry installed.

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

Open http://localhost:8000/admin/ in your browser to access the Django admin panel.

  • Username: admin
  • Password: 1

What's Next?

  • Getting Started: Step-by-step guide to configuring content settings in your project and adding your first setting.
  • Setting Types and Attributes: Guide to all available basic types and attributes, with examples.
  • Template Types: The most powerful feature of content settings, where raw values are text, but the setting value is a function.
  • Using Settings: Explore multiple ways to access content settings in your project.
  • Permissions: Define distinct permissions for different settings' functionality.
  • Defaults Context: Group settings with common parameters to reduce redundancy and maintain cleaner code.
  • API & Views: Organize access to content settings via APIs.
  • User Interface for Django Admin: End-user guide to using the Django Admin panel for content settings.
  • How Caching is Organized: Ensure fast and efficient content settings performance, with configurable options.
  • Available Django Settings: Reference all available Django settings for content settings.
  • User-Defined Settings: Experimental functionality for allowing Django Admin users to create settings directly from the UI.
  • Possible Extensions: WIP - Extend the basic functionality of content settings.
  • Cookbook: Practical recipes for using content settings in your project.
  • Frequently Asked Questions: Answers to common questions.
  • Glossary: Definitions of terms introduced by the concept of content settings.
  • How to Contribute: Guidelines for contributing to the project.
  • Changelog: Overview of updates introduced in each version.
  • Source Doc: Compilation of docstrings for future reference.

Metadata

Release files for django-content-settings 0.29.2

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-content-settings 0.29.2
File Size Uploaded Provenance
django_content_settings-0.29.2.tar.gz 64.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-content-settings 0.29.2
File Interpreter ABI Platform
django_content_settings-0.29.2-py3-none-any.whl Python 3 none any Details

Total release size: 147.3 kB

Release files / django_content_settings-0.29.2.tar.gz

Download URL django_content_settings-0.29.2.tar.gz
Size 64.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d157f04b4f1755547575ca06af0c05d3c5658cbbba0afd891f3ca41837f074a6
BLAKE2b-256 checksum
How to use checksums
9a083a4234156393842e05cc14c8494a0b9eb2b60550187340441f8a3a4db3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.0 CPython/3.11.3 Darwin/24.1.0

Release files / django_content_settings-0.29.2-py3-none-any.whl

Download URL django_content_settings-0.29.2-py3-none-any.whl
Size 82.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f829a7bad9aed3b74793f03702355e738fd0b37163615aebb08c7f2f9aece08f
BLAKE2b-256 checksum
How to use checksums
fde56f519b85ce3117ec396f215eadd33e6a1ea825b838039a960270bcbcc8d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.0 CPython/3.11.3 Darwin/24.1.0

Security for django-content-settings 0.29.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.29.2 This release

2 release files No provenance

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