add captcha validation for the nomination form

master
David Beltra 4 years ago
parent 9351b442e5
commit e1bf05493c

@ -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']

@ -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>

@ -263,6 +263,7 @@ INSTALLED_APPS = (
"mezzanine.twitter",
# "mezzanine.accounts",
"captcha",
"apps.blocks",
"apps.components.button",
"apps.components.icon",

@ -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