http://code.google.com/p/django-simple-captcha/をdjangoコメントで使用する方法を理解しようとしています。私はここで説明されているようにすべてを行いました:http: //docs.djangoproject.com/en/dev/ref/contrib/comments/custom/
したがって、カスタムコメントアプリのフォームは次のようになります。
from django import forms
from django.contrib.comments.forms import CommentForm
from captcha.fields import CaptchaField
class CommentFormWithCaptcha(CommentForm):
captcha = CaptchaField()
def get_comment_model(self):
# Use our custom comment model instead of the built-in one.
return Comment
そして私の__init__.py
ファイル:
from protected_comments.forms import CommentFormWithCaptcha
def get_form():
return CommentFormWithCaptcha
キャプチャフィールドはレンダリングされますが、入力が有効かどうかを確認する方法がわかりません。例:simple-captchadocsは次のように述べています
if form.is_valid():
human = True
しかし、これをどこに追加できるのかよくわかりません。オーバーライドできるメソッドがforms.pyにありますか?