Installation
Add textblocks and optionally modeltranslation to INSTALLED_APPS
Add an entry for textblocks to your MIGRATION_MODULES (textblocks cannot ship its own migrations because the exact schema depends on your LANGUAGES setting) and create an empty Python module (folder with an empty __init__.py file).
Run ./manage.py makemigrations textblocks and ./manage.py migrate
Usage
Load templatetags {% load textblock_tags %}
Add textblock tags with unique identifiers:
{% textblock "introduction" %}
Text blocks with identifiers that do not exist in the database yet will automatically be created.
You can optionally provide the following keyword arguments:
Argument |
Description |
Possible Values |
Default |
|---|---|---|---|
type |
Sets the content type. |
text/plain, text/html |
text/plain |
show_key |
If set to true, the template will render the textblock key for textblocks without a value. |
False, 0, True, 1 |
False |
The default value for the show_key-option can be overriden with the TEXTBLOCKS_SHOWKEY = True-setting.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-textblocks-0.8.3.tar.gz.
File metadata
- Download URL: django-textblocks-0.8.3.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4e75c0fd6af6fdb0b5c95dbdf10c6f6dd8a4f002fe4f55838857b9ed1346dc6
|
|
| MD5 |
b2ff56084765b55fc4718d55656d57c0
|
|
| BLAKE2b-256 |
5018768da79fdd3de8c2c876bef4c63f107698cb004a8d02ba18f286dcebbb8b
|