Ability to easily create and manage editable variables directly from the Django admin panel
Project description
Django Content Settings
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
- Type-Agnostic Variable Creation: Users can create variables of any type, making the module highly adaptable to various needs.
- Editability from Django Admin Panel: Seamless integration with the Django admin panel allows for effortless editing of variables.
- Caching System: Ensures high performance, negating the impact of variable complexity on code execution speed.
For the full documentation, please visit here.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_content_settings-0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37fbe684b0002f5bf28e15a2de99612cbad524b9c06fbb6022171b5c79115d8d |
|
MD5 | 82fa4614070f5353ce744aece126d4cf |
|
BLAKE2b-256 | 9c527a076dcf3214a588fe3235aae72dad27b2229bb13cfeaff273452c8fa024 |
Hashes for django_content_settings-0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc337d77e505fd5034455ae971b989129fc7de83c41caac764d946f9fb4ebdc4 |
|
MD5 | 59c9caffc9785536769af5d7d97f136f |
|
BLAKE2b-256 | 4a208ad706fb519e30a9ec48ab3618a2cea59d846f25cde92061e10eaf94f020 |