A tool to protect formulaire from spam.
Project description
Prune's Captcha
What is it for?
Captcha helps prevent robots from spamming using your forms.
Prerequisites
- To be installed on a Prune Django project that uses poetry or UV
UV project
Installation
Run the following command in the console:
uv add captcha_prune
Updating the captcha
Don't hesitate to regularly run uv sync --upgrade, as the captcha evolves with time and our practices!
Poetry project
Installation
Run the following command:
poetry add prune_captcha
Updating the captcha
Don't hesitate to regularly run poetry update, as the captcha evolves with time and our practices!
Captcha Integration
Configuration
In settings.py, set the path to the images used for the puzzle:
PUZZLE_IMAGE_STATIC_PATH = "website/static/website/images/puzzles/"
Important: You must import the static files (css, js) present in "captcha_prune/static/".
Utilisation
-
GET request (form display)
-
Use create_and_get_captcha to generate the captcha data:
from captcha_prune.utils import create_and_get_captcha
puzzle = create_and_get_captcha(request)
-
Passes the data into the context under the puzzle variable:
return render( request, "website/pages/contact/page.html", {"form": form, "puzzle": puzzle}, )
-
Include the component in your template:
{% include "captcha_prune/captcha.html" %}
-
-
POST request (form submission)
-
Use verify_captcha to validate the captcha:
from captcha_prune.utils import verify_captcha
response = verify_captcha(request)
-
True if the captcha is correct, else False.
-
Redirects in case of incorrect captcha.
-
Available Versions
| Version | Date | Notes |
|---|---|---|
| 1.13.0 | 2025-05-21 | use session, add static |
| 1.12.2 | 2025-05-21 | doc fixed |
| 1.12.1 | 2025-05-21 | doc fixed |
| 1.12.0 | 2025-05-21 | removed views, added utils, ... |
| 1.11.0 | 2025-05-21 | removed utils |
| 1.10.0 | 2025-05-20 | fix documentation, removed ... |
| 1.9.0 | 2025-05-20 | puzzle images path fixed |
| 1.8.0 | 2025-05-20 | added migrations |
| 1.7.0 | 2025-05-20 | PUZZLE_IMAGE_STATIC_PATH ... |
| 1.6.0 | 2025-05-20 | added templates |
| 1.5.0 | 2025-05-20 | app config fixed, components ... |
| 1.4.0 | 2025-05-20 | added BaseModel in Captcha, ... |
| 1.3.0 | 2025-04-30 | deleted start_server, deleted ... |
| 1.2.0 | 2025-04-30 | fixed prune_captcha command, ... |
| 1.1.0 | 2025-04-30 | start_server was not a module, ... |
| 1.0.0 | 2025-04-29 | First version of the captcha ... |
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 prune_captcha-1.13.0.tar.gz.
File metadata
- Download URL: prune_captcha-1.13.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.31
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8800446e267cb760a6deba1b77fb2894107c0997de3ae65bb6f76b03c26a299e
|
|
| MD5 |
255f6c5cfef43083cbc735e56696579e
|
|
| BLAKE2b-256 |
90feed705e059242d62fdf0f6416b3b84c75896570eea36be0f3243d7f4c2c50
|
File details
Details for the file prune_captcha-1.13.0-py3-none-any.whl.
File metadata
- Download URL: prune_captcha-1.13.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.31
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a959b8bf85f5142d62bbb33f1c9e92a08cf06c4355a24ade3ab6ec3ca871c9
|
|
| MD5 |
a680bbb2613bde71d23b8d104255a23a
|
|
| BLAKE2b-256 |
68bfa70f4efb66d7f0991cba8de69c2efee4b71a9e8eed40012102bf01d8b491
|