Skip to main content

A Wagtail extension to open custom chooser from RichText Editor.

Project description

Wagtail Link Snippet

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

How to use it

Overview

The package integrates with Wagtail’s ChooserViewSet (Wagtail documentation). The package works only if the snippet has the get_absolute_url method implemented.

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-1.0.1.tar.gz (8.1 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-1.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wagtail_linksnippet-1.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for wagtail_linksnippet-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2830669458b5ecb82610e3091392d559da1ac54a7ed65f38e2d5d943bee46e2b
MD5 86af2ecfb3fe4b19d7bd27b5a25381b7
BLAKE2b-256 12691705b94d3f31cdc296b41b454df4886026b93aa13e8c0d516e73c76583d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtail_linksnippet-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6710c959d32fd24e2c99ac6944b31089ef2771a1f2eb77005e0a7ac4d656ce76
MD5 43496cf827f9ca05e1578fcf03184f4a
BLAKE2b-256 612ba872a25244b41e25f03261e6023596f7f3ff12d80b16453d873d83d85164

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