Browse Source

add captcha validation for the nomination form

master
David Beltra 1 year ago
parent
commit
e1bf05493c
4 changed files with 7 additions and 2 deletions
  1. +2
    -0
      apps/nominations/forms.py
  2. +1
    -1
      apps/nominations/templates/pages/nominierungen.html
  3. +1
    -0
      bigbrother/settings.py
  4. +3
    -1
      bigbrother/urls.py

+ 2
- 0
apps/nominations/forms.py View File

@@ -1,9 +1,11 @@
from django import forms
from django.forms import ModelForm
from captcha.fields import CaptchaField
from django.utils.translation import gettext_lazy as _
from .models import Nomination

class NominationForm(ModelForm):
captcha = CaptchaField()
class Meta:
model = Nomination
fields = ['nominated', 'reasons_nomination', 'name', 'email', 'sk', 'dg', 'pep', 'ccc']


+ 1
- 1
apps/nominations/templates/pages/nominierungen.html View File

@@ -48,7 +48,7 @@
{% endif %}
{% nevercache %}
{% if field.errors %}
<p class="alert alert-error">{{field.errors}}</p>
<div class="alert alert-error">{{field.errors}}</div>
{% endif %}
{% endnevercache %}
</div>


+ 1
- 0
bigbrother/settings.py View File

@@ -263,6 +263,7 @@ INSTALLED_APPS = (
"mezzanine.twitter",
# "mezzanine.accounts",

"captcha",
"apps.blocks",
"apps.components.button",
"apps.components.icon",


+ 3
- 1
bigbrother/urls.py View File

@@ -16,7 +16,9 @@ import os

admin.autodiscover()

urlpatterns = []
urlpatterns = [
url(r'^captcha/', include('captcha.urls')),
]

# Add the urlpatterns for any custom Django applications here.
# You can also change the ``home`` view to add your own functionality


Loading…
Cancel
Save