Skip to main content

Django Text Chunks

Insert blocks of text anywhere in in your template

Installation

Install package using pip

$ pip install django-textchunks

Basic usage

Add the textchunks application to INSTALLED_APPS in your settings file (usually settings.py)

INSTALLED_APPS = (
    ...
    'textchunks',
    ...
)

Sync database with ./manage.py migrate. After that, add textchunks using django admin interface and use them on your templates:

{% load textchunks %}

<html>
  <head>
    <title>Test</title>
    {% textchunk "google_analytics" %}
  </head>
  <body>
    <h1>Blah blah blah</h1>
    <div id="sidebar">
        ...
    </div>
    <div id="left">
        {% textchunk "home_page_left" %}
    </div>
    <div id="right">
        {% textchunk "home_page_right" %}
    </div>
  </body>
</html>

Advanced usage

There are two template tags available: textchunk and textchunk_plain. Text displayed with textchunk is not escaped, any html and javascript is rendered or executed. textchunk_plain tag uses from django.utils.html.escape to escape it’s content, so it’s safe to render user-entered text.

textchunk tag uses django Template object to render data and has access to template context. So, text

<span>{{ request.user.username }}</span>

for user with username as agentsmith will be rendered as

<span>agentsmith</span>

Metadata

Release files for django-textchunks 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-textchunks 0.1.1
File Size Uploaded Provenance Actions
django-textchunks-0.1.1.tar.gz 4.6 kB Without provenance Details for django-textchunks-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-textchunks 0.1.1
File Interpreter ABI Platform Actions
django_textchunks-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for django_textchunks-0.1.1-py2.py3-none-any.whl

Total release size: 11.3 kB

Release files / django-textchunks-0.1.1.tar.gz

Download URL django-textchunks-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3dc7ead7939a13656964a6f8baf3a39b34f227910091edbfcd8380d57cffd5c0
BLAKE2b-256 checksum
How to use checksums
6d0840bdeeb7b6fe3f78f7a88ccc8d1dce1275a92d2f87ba5144de3f6a5ef03e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_textchunks-0.1.1-py2.py3-none-any.whl

Download URL django_textchunks-0.1.1-py2.py3-none-any.whl
Size 6.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4687b1e2a92aaa221c3dab4de2c6fdca81454899c4d5f2de57606cbc6b0e98e6
BLAKE2b-256 checksum
How to use checksums
e6bc99b153efc4ce709086ecb2662612f53cffefa7dcfe0bf676958b15722b4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-textchunks 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page