Skip to main content

A Wagtail extension to open custom chooser from RichText Editor.

Project description

Wagtail Link Snippet

This project provides a custom implementation for adding link buttons in Wagtail’s rich text editor to link specific snippets within the Wagtail admin interface.

Overview

The package integrates with Wagtail’s ChooserViewSet (Wagtail documentation).

Installation and Setup

pip install watail_linksnippet

Make sure to include the relevant app that contains the rich text features and handlers in your INSTALLED_APPS within settings.py.

INSTALLED_APPS = [
    # Other installed apps
    'wagtail_linksnippet',
]

Usage Example

You can configure the snippet choosers in your wagtail_hooks.py file by registering the chooser viewsets.

from wagtail_linksnippet.richtext_utils import add_snippet_link_button

add_snippet_link_button(snippet1_chooser_viewset)
add_snippet_link_button(snippet2_chooser_viewset)

Bonus TitleExtraChooseView

The package includes a view_utils.py module designed to add attributes to chooser modal links, similar to how attributes are handled in the page chooser modal.

Here’s an example of how to use the TitleExtraChooseView module:

# views.py

from wagtail.admin.views.generic.chooser import ChooseView
from wagtail_linksnippet.views_utils import CustomChooseView

class CustomChooseView(TitleExtraChooseView):
    # Your code here

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_linksnippet-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtail_linksnippet-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_linksnippet-0.1.0.tar.gz.

File metadata

  • Download URL: wagtail_linksnippet-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for wagtail_linksnippet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 194c063bbb63c2208b60d628aa53d40dc802f1cca1de8ea055dd6f367251eed4
MD5 8cbccc427bc1d83e9381143668e2c698
BLAKE2b-256 b2ae4276034ad3fe43bee92f0567705908e60071b179dffd1e7bcbcf5d2a2d4a

See more details on using hashes here.

File details

Details for the file wagtail_linksnippet-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_linksnippet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 137a8c2a6e3793b89535e0dbcde6445d6308f5f7bdd7787bf34bfce7ee8b4aeb
MD5 c52a183007f23144d07e971210ccc4c7
BLAKE2b-256 0dfab0ecab07ca6ede9d65ec24872c4939e270181fe515d461f8ab108601dd16

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page