A Django app for integrating Cloudflare Turnstile into forms.
Project description
django-cf-turnstile
django-cf-turnstile is a Django app for integrating Cloudflare Turnstile captchas into django forms.
Note that django-cf-turnstile only supports implicit rendering of widgets.
Requirements
- Python: 3.10+
- Django: 4.2+
Installation
Install the package with:
pip install django-cf-turnstile
Add "django_cf_turnstile" to your INSTALLED_APPS setting.
INSTALLED_APPS = [
...,
"django_cf_turnstile",
]
Add your Turnstile site key and secret to your django settings.
# django-cf-turnstile
# Dummy keys used below, replace with your actual keys
CF_TURNSTILE_SITE_KEY = "1x00000000000000000000AA"
CF_TURNSTILE_SECRET_KEY = "1x0000000000000000000000000000000AA"
Note that if you don't provide a site key and secret key the test site keys which always pass validation will be used.
For more information on test keys see https://developers.cloudflare.com/turnstile/troubleshooting/testing/.
Usage
In your Django forms import and use TurnstileCaptchaField
from django import forms
from django_cf_turnstile.fields import TurnstileCaptchaField
class CaptchaSignupForm(forms.Form):
...
captcha = TurnstileCaptchaField()
Customization
Overriding Keys
Keys may be overridden on individual forms by passing in site_key and secret_key.
class CaptchaSignupForm(forms.Form):
captcha = TurnstileCaptchaField(
site_key="3x00000000000000000000FF",
secret_key="1x0000000000000000000000000000000AA"
)
Adding Labels
By default, the label is set to an empty string.
This can be overridden by setting label.
class CaptchaSignupForm(forms.Form):
captcha = TurnstileCaptchaField(label="Captcha")
Credits
Inspired by django-recaptcha
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 django_cf_turnstile-0.1.0.tar.gz.
File metadata
- Download URL: django_cf_turnstile-0.1.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdc2e06d2dd75d18f6be53436c4a58b467cac7f0ef7737989c4eaa814b9d6b5f
|
|
| MD5 |
b4040f9f883944d0f6b345f93817d224
|
|
| BLAKE2b-256 |
579709cd52730e58d9a227802b779a397c7705c287429f9cbab2084bcdda6ac4
|
Provenance
The following attestation bundles were made for django_cf_turnstile-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on ronaldgrn/django-cf-turnstile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_cf_turnstile-0.1.0.tar.gz -
Subject digest:
bdc2e06d2dd75d18f6be53436c4a58b467cac7f0ef7737989c4eaa814b9d6b5f - Sigstore transparency entry: 238235736
- Sigstore integration time:
-
Permalink:
ronaldgrn/django-cf-turnstile@eed5de3fd9e58b5d77dd2b4092936d020be366a2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ronaldgrn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@eed5de3fd9e58b5d77dd2b4092936d020be366a2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_cf_turnstile-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_cf_turnstile-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2acfcda3cb85eefb43da63bddbc833776fbd901726d1b1e744eee5f1009d197f
|
|
| MD5 |
36673c90f2d18bb592597cd0d93e3ebd
|
|
| BLAKE2b-256 |
7aec92abc03db369177f12b5685ee96aa3706d194ad1d45ac918f1d07f124689
|
Provenance
The following attestation bundles were made for django_cf_turnstile-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on ronaldgrn/django-cf-turnstile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_cf_turnstile-0.1.0-py3-none-any.whl -
Subject digest:
2acfcda3cb85eefb43da63bddbc833776fbd901726d1b1e744eee5f1009d197f - Sigstore transparency entry: 238235739
- Sigstore integration time:
-
Permalink:
ronaldgrn/django-cf-turnstile@eed5de3fd9e58b5d77dd2b4092936d020be366a2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ronaldgrn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@eed5de3fd9e58b5d77dd2b4092936d020be366a2 -
Trigger Event:
release
-
Statement type: