https://github.com/vb64/django.keycaptcha
Keycaptcha field for Django forms
https://github.com/vb64/django.keycaptcha
Last synced: about 1 year ago
JSON representation
Keycaptcha field for Django forms
- Host: GitHub
- URL: https://github.com/vb64/django.keycaptcha
- Owner: vb64
- License: mit
- Created: 2016-05-25T06:45:52.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-25T07:49:57.000Z (about 10 years ago)
- Last Synced: 2025-02-03T15:55:32.358Z (over 1 year ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django.keycaptcha
Keycaptcha field for Django forms
Based at this [keycaptcha sample](https://www.keycaptcha.ru/python-captcha-api/).
Register your keycaptcha.com account, then replace values of 'KeyCAPTCHA_PrivateKey' and 'KeyCAPTCHA_UserID' keys in `keycaptcha.py` with proper values from your keycaptcha.com account.
Then you can use keycaptcha field in your Django forms to protect these forms from spam.
```python
from django import forms
import keycaptcha
class MyForm(forms.Form):
keycaptcha = keycaptcha.Field()
...
form = MyForm(initial={'keycaptcha': request.META['REMOTE_ADDR']})
...
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
...
```
Template:
```
{% csrf_token %}
{{myform.as_p}}
```