Example: Django form with server-side verification
examples/ has runnable integrations for Hono, Supabase, FastAPI and a plain Node contact form. A Django example would cover a lot of Python users.
What to do
Add examples/django/ with:
- a form view whose template renders the checkbox widget
- server-side verification of the posted
fcaptcha_tokenagainst/turnstile/v0/siteverifyor/api/token/verify(a small form field or a validator is fine) - tests for a valid, a replayed and a missing token, in the style of
examples/fastapi/test_main.py - a README with how to run it against a local FCaptcha server
Bonus: a note on using django-recaptcha unchanged by setting RECAPTCHA_DOMAIN to your FCaptcha server, which v1.45.0 makes possible.
Done when
The example runs from its README, and a link is added under "Runnable examples" in the main README.
Thanks, @Vedant-200. Please go ahead with the runnable example. There is now a Django integration guide in INSTALLATION.md, so please reuse that contract rather than duplicating the guide: https://github.com/WebDecoy/FCaptcha/blob/main/INSTALLATION.md
The missing piece here is still a runnable examples/django app with tests. Keep the verification secret server-side, verify before the protected action, and cover missing, rejected/replayed, and unavailable verification as well as success. Please use the current documented site-key/hostname/action checks. A focused PR with its run/test commands would be helpful.