Cloudflare Turnstile integration for Wagtail forms
Project description
Wagtail Turnstile
A lightweight Cloudflare Turnstile integration for Wagtail form pages.
Drop-in support with minimal configuration — and no Google reCAPTCHA required.
Features
- Adds a Turnstile field type to Wagtail’s form builder
- Validates Turnstile submissions server-side
Installation
pip install wagtail-turnstile
Then add it to your Django settings:
INSTALLED_APPS = [
...
"turnstile",
]
Add your Cloudflare Turnstile site and secret keys to your settings.py:
TURNSTILE_SITE_KEY = "your-site-key"
TURNSTILE_SECRET_KEY = "your-secret-key"
Usage
Here's a sample contact form page and field. Subclassing
TurnstileAbstractFormField will add a new form field type,
labelled to the user as "Captcha". This will handle the challenge
and validation flow with Turnstile.
from turnstile.models import TurnstileAbstractFormField, TurnstileFormBuilder
class FormField(TurnstileAbstractFormField):
page = ParentalKey(
"ContactPage",
on_delete=models.CASCADE,
related_name="form_fields"
)
class ContactPage(AbstractEmailForm):
form_builder = TurnstileFormBuilder
Todo
Quite a lot, I would assume. It probably needs to be more customisable, and we don't need to store the Turnstile token.
Got any suggestions?
Feel free to raise an issue, and if you have a fix, submit a merge request and I'll be glad to take a look.
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
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_turnstile-0.6.0.tar.gz.
File metadata
- Download URL: wagtail_turnstile-0.6.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35e54d0a3d9d2134873be8eb5cbdf6fa49ca422c0d7a519521b10cbb3766887
|
|
| MD5 |
af456e63f3e26bcb3bd93c424a745437
|
|
| BLAKE2b-256 |
4b7ccdbb9f98e30e42ca3261bf9682e690d1e364f4e69646f1b1f3b156424d56
|
Provenance
The following attestation bundles were made for wagtail_turnstile-0.6.0.tar.gz:
Publisher:
publish.yml on soundslocalcic/wagtail-turnstile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_turnstile-0.6.0.tar.gz -
Subject digest:
a35e54d0a3d9d2134873be8eb5cbdf6fa49ca422c0d7a519521b10cbb3766887 - Sigstore transparency entry: 882804596
- Sigstore integration time:
-
Permalink:
soundslocalcic/wagtail-turnstile@c78225f5659f78cc90b4b286e33c302099f7fd13 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/soundslocalcic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c78225f5659f78cc90b4b286e33c302099f7fd13 -
Trigger Event:
push
-
Statement type:
File details
Details for the file wagtail_turnstile-0.6.0-py3-none-any.whl.
File metadata
- Download URL: wagtail_turnstile-0.6.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52911e09e284e1bd588942f3bf8b024e187ef1bd3a5145577124191c1fb58b3c
|
|
| MD5 |
f7a1dbe23e00624592e687cc2a7d69c6
|
|
| BLAKE2b-256 |
4dbcb7f22a3ee5b57e8be910ea48cdcac309698b3341f21b51d54bc19343dee0
|
Provenance
The following attestation bundles were made for wagtail_turnstile-0.6.0-py3-none-any.whl:
Publisher:
publish.yml on soundslocalcic/wagtail-turnstile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_turnstile-0.6.0-py3-none-any.whl -
Subject digest:
52911e09e284e1bd588942f3bf8b024e187ef1bd3a5145577124191c1fb58b3c - Sigstore transparency entry: 882804663
- Sigstore integration time:
-
Permalink:
soundslocalcic/wagtail-turnstile@c78225f5659f78cc90b4b286e33c302099f7fd13 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/soundslocalcic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c78225f5659f78cc90b4b286e33c302099f7fd13 -
Trigger Event:
push
-
Statement type: