Add hcaptcha support and .env file

hcaptcha can be turned on in settings.py with parameters in the .env
file

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-07 14:51:26 -07:00
parent fe8ea04d18
commit 6e2c29ae29
4 changed files with 37 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
from django.conf import settings
from django.forms import ModelForm
from board.models import Post
from hcaptcha.fields import hCaptchaField
class PostForm(ModelForm):
@@ -9,6 +11,8 @@ class PostForm(ModelForm):
This requires the board and the IP address to be specified.
"""
hcaptcha = hCaptchaField() if settings.USE_HCAPTCHA else None
class Meta:
model = Post
fields = ["subject", "name", "text", "image"]
@@ -27,6 +31,8 @@ class ReplyForm(PostForm):
specified.
"""
hcaptcha = hCaptchaField() if settings.USE_HCAPTCHA else None
class Meta:
model = Post
fields = ["name", "text", "bump", "image"]