django-content-settings


Namedjango-content-settings JSON
Version 0.12.2 PyPI version JSON
download
home_pagehttps://django-content-settings.readthedocs.io/en/latest/
SummaryDCS - the most advanced admin editable setting
upload_time2024-03-07 10:42:31
maintainer
docs_urlNone
authoroduvan
requires_python>=3.8
licenseMIT
keywords django settings
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://django-content-settings.readthedocs.io/).

[▶️ YouTube Video with dive deep ~ 2h](https://youtu.be/RNYmvv_G5zs) 

### How does it look

- **Setup**. [Here](https://django-content-settings.readthedocs.io/en/latest/first/) 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

```python
# 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

```bash
$ 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. 

```python

from content_settings.conf import content_settings

content_settings.TITLE
```

In template:

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

In API:

```bash
$ 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:

```python
# 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](https://django-content-settings.readthedocs.io/en/latest/types/) about the types available for you.

It is also very fast thanks to our caching system. [Read more about it](https://django-content-settings.readthedocs.io/en/latest/caching/).

Some fancy things you can find in our [cookbook](https://django-content-settings.readthedocs.io/en/latest/cookbook/).
            

Raw data

            {
    "_id": null,
    "home_page": "https://django-content-settings.readthedocs.io/en/latest/",
    "name": "django-content-settings",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "Django,settings",
    "author": "oduvan",
    "author_email": "a.lyabah@checkio.org",
    "download_url": "https://files.pythonhosted.org/packages/6a/27/5cf8cd60a618c6bd99e7a1306aeb893ff6f5841baf3a758b2a9b81335ccc/django_content_settings-0.12.2.tar.gz",
    "platform": null,
    "description": "# Django Content Settings - the most advanced admin editable setting\n\nThe `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.\n\n### Key Features\n\n1. **Type-Agnostic Variable Creation**: Users can create variables of any type, making the module highly adaptable to various needs.\n2. **Editability from Django Admin Panel**: Seamless integration with the Django admin panel allows for effortless editing of variables.\n3. **Flaxable permission model**: Every setting can have own permission rule for view, edit, fetch in API and view changes history.\n4. **Preview**: Preview setting before apply and addition option to preview setting change right on site.\n5. **Caching System**: Ensures high performance, negating the impact of variable complexity on code execution speed.\n\nFor the full documentation, please visit [here](https://django-content-settings.readthedocs.io/).\n\n[\u25b6\ufe0f YouTube Video with dive deep ~ 2h](https://youtu.be/RNYmvv_G5zs) \n\n### How does it look\n\n- **Setup**. [Here](https://django-content-settings.readthedocs.io/en/latest/first/) you can get step-by-step instruction.\n\n- **Define the setting**. To do so you need to define constant in `content_settings.py` in your app\n\n```python\n# content_settings.py\n\nfrom content_settings.types.basic import SimpleString\n\nTITLE = SimpleString(\"Songs\", help=\"The title of the site\")\n```\n\nthe code above defines a variable `TITLE`, with type `SimpleString` and default value `Songs`.\n\n- **Migrate**. In order to be able to edit data in Django Admin\n\n```bash\n$ python manage.py migrate\n```\n\n_Technically, you can use variable in code even without migration. The migration is need to make variable editable in admin panel_\n\n- **Use it in your project**. That is it. You can the variable `TITLE` in your code. \n\n```python\n\nfrom content_settings.conf import content_settings\n\ncontent_settings.TITLE\n```\n\nIn template:\n\n```html\n<h2>{{CONTENT_SETTINGS.TITLE}}</h2>\n```\n\nIn API:\n\n```bash\n$ curl http://127.0.0.1/content-settings/fetch/title/\n```\n\nOk, I lied, in order to use in API you need to update permission from the setting:\n\n```python\n# content_settings.py\n\nfrom content_settings.types.basic import SimpleString\nfrom content_settings import permissions\n\nTITLE = SimpleString(\n    \"Songs\",\n    fetch_permission=permissions.any,\n    help=\"The title of the site\",\n)\n```\n\nSimple 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](https://django-content-settings.readthedocs.io/en/latest/types/) about the types available for you.\n\nIt is also very fast thanks to our caching system. [Read more about it](https://django-content-settings.readthedocs.io/en/latest/caching/).\n\nSome fancy things you can find in our [cookbook](https://django-content-settings.readthedocs.io/en/latest/cookbook/).",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "DCS - the most advanced admin editable setting",
    "version": "0.12.2",
    "project_urls": {
        "Homepage": "https://django-content-settings.readthedocs.io/en/latest/",
        "Repository": "https://github.com/occipital/django-content-settings/"
    },
    "split_keywords": [
        "django",
        "settings"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9e885d3805e0e19783b2c4cc518a02d0aa55876858d230527dff2ae249c2c45",
                "md5": "329a2f5a3f76e722a0178f4d44f84651",
                "sha256": "dda2cbd61086d4e9d9dbf930f8e085205fd0aae4ac6bd88266281451667b67e9"
            },
            "downloads": -1,
            "filename": "django_content_settings-0.12.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "329a2f5a3f76e722a0178f4d44f84651",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 50070,
            "upload_time": "2024-03-07T10:42:28",
            "upload_time_iso_8601": "2024-03-07T10:42:28.951892Z",
            "url": "https://files.pythonhosted.org/packages/b9/e8/85d3805e0e19783b2c4cc518a02d0aa55876858d230527dff2ae249c2c45/django_content_settings-0.12.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a275cf8cd60a618c6bd99e7a1306aeb893ff6f5841baf3a758b2a9b81335ccc",
                "md5": "9aca46497067b9ab4ddc1ea8c6209670",
                "sha256": "381bb3d298bf1dae917b5dcfc1c15991e53afbba06c74968eb338d8464fda8a1"
            },
            "downloads": -1,
            "filename": "django_content_settings-0.12.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9aca46497067b9ab4ddc1ea8c6209670",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 38286,
            "upload_time": "2024-03-07T10:42:31",
            "upload_time_iso_8601": "2024-03-07T10:42:31.500106Z",
            "url": "https://files.pythonhosted.org/packages/6a/27/5cf8cd60a618c6bd99e7a1306aeb893ff6f5841baf3a758b2a9b81335ccc/django_content_settings-0.12.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-07 10:42:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "occipital",
    "github_project": "django-content-settings",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-content-settings"
}
        
Elapsed time: 0.20882s