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
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>
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
Close
Hashes for wagtail_link_block-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c85338e8df53380fae2404f0d0920a68d5e95ae27984b9809faf30595837ded4 |
|
MD5 | 3b34023ed50fb476ba7ebc0464a6a4df |
|
BLAKE2b-256 | 981a9afe4876c84a5653630212168d4984d7391de53b799593014d602e3f01e6 |