Wagtail LinkBlock
Project description
A link block to use as part of other StructBlocks which lets the user choose a link either to a Page, Document, or external URL, 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
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>
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
wagtail-link-block-0.1.tar.gz
(6.1 kB
view hashes)
Built Distribution
Close
Hashes for wagtail_link_block-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50826e6c7f7cfab517530fa53515542d1dc779eb4feee1e05034e7a34c3972d6 |
|
MD5 | 8992e72090f9b4982f19ee7319a729af |
|
BLAKE2b-256 | e9da6473a38378b78621a5f91a2575b34984aa235e2f906050ac9c2ecabf9023 |