Wagtail links provides a consistent way to refer to links in a wagtail page.
Project description
wagtail-links
Purpose
Wagtail links has two goals:
- Provide a consistent way to refer to links, which may be of different types, so as to reduce decision fatigue
- Minimize broken links as much as possible.
Install
Install wagtail-links via Pip.
pip install wagtail-links
Add wagtail_links to your Django project's INSTALLED_APPS setting.
Run database migrations.
python manage.py migrate
Usage
Add a foreign key to the page you wish to add links to.
my_link = models.ForeignKey(
'wagtail_links.Link',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
Neat:
You may use it like:
<a href="{{ self.link.url }}">Link here</a>
From a template, you can also load a link by its name:
{% load get_wagtail_link_url from wagtail_links %}
<a href="{% get_wagtail_link_url 'my-link' %}">Link here</a>
This is useful for global page links, navigation, etc.
Validation and logging
The Link model will validate that one and only one field is set. It will also disallow invalid Django reverse view names.
If a URL cannot be determined, we'll log the issue as a warning. We won't throw an exception as that would be bad for users. You are responsible for capturing this log warning, perhaps using Sentry.
For example - let's say you make a Django view name called admin:index. This would typically give you /admin/. Later the admin application is removed from the program, now this link fails. It will now display "" and generate a warning in your server logs.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagtail_links-2.11.0.tar.gz.
File metadata
- Download URL: wagtail_links-2.11.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d5d714f7fcaba0060f2fa3b73ffb4b5f82b0fe53b7e1af153c361571f36937
|
|
| MD5 |
de3f94dd22adfdb337681267dcd8e181
|
|
| BLAKE2b-256 |
bcfde3baeba808d97f96d559f5504c54be7e260f49a45f3245bd4781f4104b8d
|
Provenance
The following attestation bundles were made for wagtail_links-2.11.0.tar.gz:
Publisher:
.gitlab-ci.yml on thelabnyc/wagtail-links
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_links-2.11.0.tar.gz -
Subject digest:
f6d5d714f7fcaba0060f2fa3b73ffb4b5f82b0fe53b7e1af153c361571f36937 - Sigstore transparency entry: 191972291
- Sigstore integration time:
-
Permalink:
thelabnyc/wagtail-links@edd2f28544b09e3fb5b098fc08eabe4bc9c247a0 -
Branch / Tag:
refs/tags/v2.11.0 - Owner: https://gitlab.com/thelabnyc
-
Access:
public
-
Token Issuer:
https://gitlab.com -
Runner Environment:
gitlab-hosted -
Publication workflow:
.gitlab-ci.yml@edd2f28544b09e3fb5b098fc08eabe4bc9c247a0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wagtail_links-2.11.0-py3-none-any.whl.
File metadata
- Download URL: wagtail_links-2.11.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8274d3a2194184b59f2b701895c2bddf99353b3db227fcf70f59978a123a3fd4
|
|
| MD5 |
f1ec2ff42f06dedfc3d862d5d39ac4c7
|
|
| BLAKE2b-256 |
f9242743c127cf67947accdf39344373f20306fa12d00237fee25aae12307fac
|
Provenance
The following attestation bundles were made for wagtail_links-2.11.0-py3-none-any.whl:
Publisher:
.gitlab-ci.yml on thelabnyc/wagtail-links
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_links-2.11.0-py3-none-any.whl -
Subject digest:
8274d3a2194184b59f2b701895c2bddf99353b3db227fcf70f59978a123a3fd4 - Sigstore transparency entry: 191972289
- Sigstore integration time:
-
Permalink:
thelabnyc/wagtail-links@edd2f28544b09e3fb5b098fc08eabe4bc9c247a0 -
Branch / Tag:
refs/tags/v2.11.0 - Owner: https://gitlab.com/thelabnyc
-
Access:
public
-
Token Issuer:
https://gitlab.com -
Runner Environment:
gitlab-hosted -
Publication workflow:
.gitlab-ci.yml@edd2f28544b09e3fb5b098fc08eabe4bc9c247a0 -
Trigger Event:
push
-
Statement type: