wrapper_tag
Wrapping template tag for django
Documentation
Wrapper tag provides base class for wrapping tag. Wrapping tag which can have defined keyword arguments, keyword arguments group in declarative way, and provide multiple steps of template rendering.
Example:
from django import template
register = template.Library()
@wrapper_tag.register_tag(register)
class ExampleTag(wrapper_tag.Tag):
title = wrapper_tag.Keyword(help_text=('title for example tag'))
class Meta:
template = "<div{{ title__rendered }}>{{ content }}</div>"
def render_title(self, argument, data, context):
if argument.name not in data:
return
return ' title="{title}"'.format(data[argument.name])
And then simply use tag in template:
{% example title="Some informational title" %}
Content
{% end:example %}
This will yield to:
<div title="Some informational title">
Content
</div>
That was just a simple eample what wrapper tag can do. It can do much more than that.
Quickstart
Install wrapper_tag:
pip install django-wrapper-tag
Then use it in a project:
INSTALLED_APPS = (
'wrapper_tag',
)
Features
Wrapper tag provides multiple features for tag and arguments.
Automatically generates documantation about arguments to tag documentation
Define tag aliases and automatically register them as tags.
Provide custom render method for tag (render_tag)
when TEMPLATE_DEBUG is enabled wrapper tag runs validations for callbacks
Tag arguments features:
default values for arguments
choices for arguments
validators for arguments
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install -r requirements_test.txt (myenv) $ python runtests.py
Credits
Tools used in rendering this package:
History
0.1.0 (2016-09-29)
First release on PyPI.
Metadata
Release files for django-wrapper-tag 0.1.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-wrapper-tag-0.1.17.tar.gz | 19.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_wrapper_tag-0.1.17-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 45.6 kB
Release files / django-wrapper-tag-0.1.17.tar.gz
| Download URL | django-wrapper-tag-0.1.17.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60946665cb0566cb0c83729be49209a93825061041914ce2efad571bd89b54f2
|
|
BLAKE2b-256 checksum How to use checksums |
c685a2cca36100bcde2a4fc12e6e9736550d9a5b6c9f2d4eaf7afc7b48879146
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_wrapper_tag-0.1.17-py2.py3-none-any.whl
| Download URL | django_wrapper_tag-0.1.17-py2.py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5f0dd1913acce3c8f0ba7021610583473141a1a07001bbcb52903371b3d3a613
|
|
BLAKE2b-256 checksum How to use checksums |
e942838c1fcb076368b247ae8fb2a92a21d19314bb61bf067ea9ab51e6a3adc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-wrapper-tag 0.1.17
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.