django-simple-tags


Namedjango-simple-tags JSON
Version 0.6.1 PyPI version JSON
download
home_page
SummaryCollection of simple django tags and filters.
upload_time2023-09-15 02:35:53
maintainerSun ZhiChuang
docs_urlNone
authorSun ZhiChuang
requires_python
licenseMIT
keywords django admin extentions django simple tags
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-simple-tags

Collection of simple django tags and filters.

## Install

```shell
pip install django-simple-tags
```

## Installed Tags or Filters

- Tags
    - `sprintf`
    - `string_format`
    - `admin_url`
    - `if_cookie`
    - `get_cookie`
    - `has_cookie`
    - `if_setting`
    - `get_setting`
    - `has_setting`
    - `model_select_include`
    - `call`
    - `call_method`
    - `reset`: reset template variable value
- Filters
    - `add_string_gap`
    - `add_string_left_gap`
    - `add_string_right_gap`
    - `get_model_verbose_name`
    - `get_model_app_label`
    - `get_model_name`
    - `get_model_fullname`
    - `show_boolean_icon`
- Utils
    - `get_related_model_field`: get model's related model and field by field name.


## Settings

**pro/settings.py**

```python
INSTALLED_APPS = [
    ...
    'django_simple_tags',
    ...
]
```

## Usage

```django
{% load django_simple_tags %}

{% load django_simple_tags %}

<h1>{% sprintf "hello %s" "Tom" %}</h1>

<h1>{% string_format "hi {0}" "Tom" %}</h1>

<h1>{% string_format "hi {name}" name="Tom" %}</h1>

<h1>{% string_format "{0} + {1} = {result}" 3 4 result=7 %}</h1>

<a href="{% admin_url cat "change" %}">{% admin_url cat "change" %}</a>

<h1>{% if_cookie request "sessionid" "sessionid exists.." "sessionid NOT exists.." %}</h1>

<h1>{% get_cookie request "sessionid" %}</h1>

<h1>{% has_cookie request "sessionid" as has_sessionid %}{% if has_sessionid %}sessionid exists..{% else %}sessionid NOT exists..{% endif %}</h1>

<h1>{% if_cookie request "xsessionid" "xsessionid exists..." "xsessionid NOT exists" %}</h1>

<h1>{% get_cookie request "xsessionid" "None" %}</h1>

<h1>{% has_cookie request "xsessionid" as has_xsessionid %}{% if has_xsessionid %}xsessionid exists...{% else %}xsessionid NOT exists...{% endif %}</h1>

<h1>{% if_setting "DEBUG" "settings.DEBUG exists..." "settings.DEBUG not exists..." %}</h1>

<h1>{% get_setting "DEBUG" %}</h1>

<h1>{% has_setting "DEBUG" as has_debug %}{% if has_debug %}settings.DEBUG exists...{% else %}settings.DEBUG NOT exists...{% endif %}</h1>

<h1>{% if_setting "NO_DEBUG" "settings.NO_DEBUG exists..." "settings.NO_DEBUG NOT exists..." %}</h1>

<h1>{% get_setting "NO_DEBUG" False %}</h1>

<h1>{% has_setting "NO_DEBUG" as has_no_debug %}{% if has_no_debug %}NO_DEBUG exists...{% else %}settings.NO_DEBUG NOT exists...{% endif %}</h1>

{% model_select_include cat "hello.html" %}

{% model_select_include cat "world.html" %}

{% model_select_include cat "hi.html" %}

<h1>{% sprintf "Select%sto view" "Category"|add_string_gap:" " %}</h1>

<h1>{% sprintf "Select%sto view" "Category"|add_string_left_gap:" ["|add_string_right_gap:"] " %}</h1>

<h1>{{model_class|get_model_app_label}}</h1>

<h1>{{model_class|get_model_name}}</h1>

<h1>{{model_class|get_model_fullname}}</h1>

<h1>{{model_class|get_model_verbose_name}}</h1>
```

## Releases

### v0.1.0 2020/02/23

- First release.

### v0.2.0 2020/02/23

- Fix document.
- Remove print statements.
- Add filters: add_string_gap, add_string_left_gap, add_string_right_gap.

### v0.3.0 2020/03/03

- Add filters: get_model_app_label, get_model_name, get_model_fullname, get_model_verbose_name.

### v0.4.0 2020/03/21

- Add tags: call, call_method

### v0.5.0 2020/03/22

- Add filter: show_boolean_icon

### v0.6.0 2020/04/27

- Add tag: reset
- Add utils.get_related_model_field

### v0.6.1 2023/09/14

- Doc update.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-simple-tags",
    "maintainer": "Sun ZhiChuang",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "sunzhichuang@zencore.cn",
    "keywords": "django admin extentions,django simple tags",
    "author": "Sun ZhiChuang",
    "author_email": "sunzhichuang@zencore.cn",
    "download_url": "https://files.pythonhosted.org/packages/9c/0b/3c36ec1e7ba5b3d3c432d5fa8d4cdca46a20d047c5aa71e3236a5068cc24/django-simple-tags-0.6.1.tar.gz",
    "platform": null,
    "description": "# django-simple-tags\n\nCollection of simple django tags and filters.\n\n## Install\n\n```shell\npip install django-simple-tags\n```\n\n## Installed Tags or Filters\n\n- Tags\n    - `sprintf`\n    - `string_format`\n    - `admin_url`\n    - `if_cookie`\n    - `get_cookie`\n    - `has_cookie`\n    - `if_setting`\n    - `get_setting`\n    - `has_setting`\n    - `model_select_include`\n    - `call`\n    - `call_method`\n    - `reset`: reset template variable value\n- Filters\n    - `add_string_gap`\n    - `add_string_left_gap`\n    - `add_string_right_gap`\n    - `get_model_verbose_name`\n    - `get_model_app_label`\n    - `get_model_name`\n    - `get_model_fullname`\n    - `show_boolean_icon`\n- Utils\n    - `get_related_model_field`: get model's related model and field by field name.\n\n\n## Settings\n\n**pro/settings.py**\n\n```python\nINSTALLED_APPS = [\n    ...\n    'django_simple_tags',\n    ...\n]\n```\n\n## Usage\n\n```django\n{% load django_simple_tags %}\n\n{% load django_simple_tags %}\n\n<h1>{% sprintf \"hello %s\" \"Tom\" %}</h1>\n\n<h1>{% string_format \"hi {0}\" \"Tom\" %}</h1>\n\n<h1>{% string_format \"hi {name}\" name=\"Tom\" %}</h1>\n\n<h1>{% string_format \"{0} + {1} = {result}\" 3 4 result=7 %}</h1>\n\n<a href=\"{% admin_url cat \"change\" %}\">{% admin_url cat \"change\" %}</a>\n\n<h1>{% if_cookie request \"sessionid\" \"sessionid exists..\" \"sessionid NOT exists..\" %}</h1>\n\n<h1>{% get_cookie request \"sessionid\" %}</h1>\n\n<h1>{% has_cookie request \"sessionid\" as has_sessionid %}{% if has_sessionid %}sessionid exists..{% else %}sessionid NOT exists..{% endif %}</h1>\n\n<h1>{% if_cookie request \"xsessionid\" \"xsessionid exists...\" \"xsessionid NOT exists\" %}</h1>\n\n<h1>{% get_cookie request \"xsessionid\" \"None\" %}</h1>\n\n<h1>{% has_cookie request \"xsessionid\" as has_xsessionid %}{% if has_xsessionid %}xsessionid exists...{% else %}xsessionid NOT exists...{% endif %}</h1>\n\n<h1>{% if_setting \"DEBUG\" \"settings.DEBUG exists...\" \"settings.DEBUG not exists...\" %}</h1>\n\n<h1>{% get_setting \"DEBUG\" %}</h1>\n\n<h1>{% has_setting \"DEBUG\" as has_debug %}{% if has_debug %}settings.DEBUG exists...{% else %}settings.DEBUG NOT exists...{% endif %}</h1>\n\n<h1>{% if_setting \"NO_DEBUG\" \"settings.NO_DEBUG exists...\" \"settings.NO_DEBUG NOT exists...\" %}</h1>\n\n<h1>{% get_setting \"NO_DEBUG\" False %}</h1>\n\n<h1>{% has_setting \"NO_DEBUG\" as has_no_debug %}{% if has_no_debug %}NO_DEBUG exists...{% else %}settings.NO_DEBUG NOT exists...{% endif %}</h1>\n\n{% model_select_include cat \"hello.html\" %}\n\n{% model_select_include cat \"world.html\" %}\n\n{% model_select_include cat \"hi.html\" %}\n\n<h1>{% sprintf \"Select%sto view\" \"Category\"|add_string_gap:\" \" %}</h1>\n\n<h1>{% sprintf \"Select%sto view\" \"Category\"|add_string_left_gap:\" [\"|add_string_right_gap:\"] \" %}</h1>\n\n<h1>{{model_class|get_model_app_label}}</h1>\n\n<h1>{{model_class|get_model_name}}</h1>\n\n<h1>{{model_class|get_model_fullname}}</h1>\n\n<h1>{{model_class|get_model_verbose_name}}</h1>\n```\n\n## Releases\n\n### v0.1.0 2020/02/23\n\n- First release.\n\n### v0.2.0 2020/02/23\n\n- Fix document.\n- Remove print statements.\n- Add filters: add_string_gap, add_string_left_gap, add_string_right_gap.\n\n### v0.3.0 2020/03/03\n\n- Add filters: get_model_app_label, get_model_name, get_model_fullname, get_model_verbose_name.\n\n### v0.4.0 2020/03/21\n\n- Add tags: call, call_method\n\n### v0.5.0 2020/03/22\n\n- Add filter: show_boolean_icon\n\n### v0.6.0 2020/04/27\n\n- Add tag: reset\n- Add utils.get_related_model_field\n\n### v0.6.1 2023/09/14\n\n- Doc update.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Collection of simple django tags and filters.",
    "version": "0.6.1",
    "project_urls": null,
    "split_keywords": [
        "django admin extentions",
        "django simple tags"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "461141d4952de9713ed23f090441ffa800f466d4a3a51d953aad7c063ceedb00",
                "md5": "dcf97e8ab74ff119d49557f9b50a609a",
                "sha256": "7d90661d76556971157be5b778b653a2cd097e722ffba03ddaedac19f508c577"
            },
            "downloads": -1,
            "filename": "django_simple_tags-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dcf97e8ab74ff119d49557f9b50a609a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5510,
            "upload_time": "2023-09-15T02:35:51",
            "upload_time_iso_8601": "2023-09-15T02:35:51.281694Z",
            "url": "https://files.pythonhosted.org/packages/46/11/41d4952de9713ed23f090441ffa800f466d4a3a51d953aad7c063ceedb00/django_simple_tags-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c0b3c36ec1e7ba5b3d3c432d5fa8d4cdca46a20d047c5aa71e3236a5068cc24",
                "md5": "7afc12643393316bfaf8002645f75dff",
                "sha256": "2a5a99b29cc020fa216976adf095f83b3d152cdab6dee600934143773d539ce3"
            },
            "downloads": -1,
            "filename": "django-simple-tags-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7afc12643393316bfaf8002645f75dff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5499,
            "upload_time": "2023-09-15T02:35:53",
            "upload_time_iso_8601": "2023-09-15T02:35:53.517627Z",
            "url": "https://files.pythonhosted.org/packages/9c/0b/3c36ec1e7ba5b3d3c432d5fa8d4cdca46a20d047c5aa71e3236a5068cc24/django-simple-tags-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-15 02:35:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-simple-tags"
}
        
Elapsed time: 0.12054s