A Block for wagtail that lets users choose a Page/Document/URL/email/etc. as a link
Project description
A link block to use as part of other StructBlocks which lets the user choose a link either to a Page, Document, external URL, Email, telephone or anchor within the current page and whether or not they want the link to open in a new window.
It hides the unused fields, making the admin clearer and less cluttered.
Usage
To install:
$ pip install wagtail-link-block
Edit your Django project’s settings module, and add the application to INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"wagtail_link_block",
# ...
]
To use in a block
from wagtail_link_block.blocks import LinkBlock
class MyButton(StructBlock):
text = CharBlock()
link = LinkBlock()
class Meta:
template = "blocks/my_button_block.html"
And the blocks/my_button_block.html
<a href="{{ self.link.get_url }}" {% if self.link.new_window %}target="_blank"{% endif %}>{{ self.text }}</a>
Developing
We’re using black, isort & flake8 for formatting & linting, and there are poetry commands in the Makefile for building, etc.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wagtail_link_block-1.1.7.tar.gz
.
File metadata
- Download URL: wagtail_link_block-1.1.7.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.8.3 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b7346bd60b65b00d7bafa48ab3b54b09c97abd085c0afd8f691be3219ff7a1c |
|
MD5 | c194bbc2f973b56efb88cd712d4560a9 |
|
BLAKE2b-256 | c39898c754b2da7b1f57c1acc22f947a134c45240764c61ee82143962913f796 |
File details
Details for the file wagtail_link_block-1.1.7-py3-none-any.whl
.
File metadata
- Download URL: wagtail_link_block-1.1.7-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.8.3 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2f0c9dedd8e1116fc347e8d5a28164376d121fa95b9c87a85ca408fc426846e |
|
MD5 | 0225852d5e74d2570513c06ade9259fd |
|
BLAKE2b-256 | 27ad320c92d1a82f434c4b7a73c6e70a5cfacd63f57e35da0e16b0660fbd1735 |