Allows only whitelisted tags and attributes through.
The setting ALLOWED_TAGS can override the behavior. The syntax of
this setting is a space-separated list of tags, which are optionally
followed by a colon and a comma-separated list of attribute permitted in
the tag.
For example, to allow <a> tags which are links or named anchors, but not
to allow definition of an onclick attribute:
ALLOWED_TAGS = "a:href,name"
In your templates, sanitizing is easy.
{% load sanitizer %}
{{ user_comment|allowtags|safe }}
{{ user_comment|allowtags:"b i"|safe }}
Disallowed tags or attributes are simply removed.
In some cases, it is useful to disallow a tag, but to convert it to something
safe, rather than stripping it entirely. For example, you might not want to
allow <h1> tags, and want to "quiet" them into <h2> tags.
{{ body|maptags:"h1=h2 h2=h3 h4=h5" }}
Metadata
Release files for django-sanitizer 0.4.1
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 | Actions |
|---|---|---|---|---|
| django-sanitizer-0.4.1.tar.gz | 3.9 kB | Without provenance | Details for django-sanitizer-0.4.1.tar.gz |
Release files / django-sanitizer-0.4.1.tar.gz
| Download URL | django-sanitizer-0.4.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d6cce3a895d29afa04d818b22713a1b49085dbca97dd109cd6c13365a3b8f98
|
|
BLAKE2b-256 checksum How to use checksums |
9e5219ab50a23ba47cdc6319461cfe0f50fb2cc5800e0186f86b216b31588dbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-sanitizer 0.4.1
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.