From 5af9d0d7484101c9ca3afed6a0a611df76aeca77 Mon Sep 17 00:00:00 2001 From: erichhasl Date: Sun, 19 Nov 2017 01:29:52 +0100 Subject: [PATCH] add captcha --- web_dev/sas_web/meingoethopia/views.py | 5 +++++ web_dev/sas_web/sas_web/settings.py | 1 + web_dev/sas_web/sas_web/urls.py | 1 + 3 files changed, 7 insertions(+) diff --git a/web_dev/sas_web/meingoethopia/views.py b/web_dev/sas_web/meingoethopia/views.py index 3bec0ca..9f9afe1 100644 --- a/web_dev/sas_web/meingoethopia/views.py +++ b/web_dev/sas_web/meingoethopia/views.py @@ -1,5 +1,6 @@ from django.shortcuts import render from django import forms +from captcha.fields import CaptchaField from .models import Betrieb, Partei, PresidentCandidate, Question @@ -8,6 +9,7 @@ class BetriebForm(forms.Form): manager = forms.CharField(label='Betriebsleiter', max_length=200) email = forms.EmailField(label='Kontakt Email') business_idea = forms.CharField(label='Idee') + captcha = CaptchaField() class ParteiForm(forms.Form): @@ -16,18 +18,21 @@ class ParteiForm(forms.Form): chef = forms.CharField(label='Parteivorsitzende', max_length=200) email = forms.EmailField(label='Kontakt Email') description = forms.CharField(label='Beschreibung') + captcha = CaptchaField() class PresidentForm(forms.Form): name = forms.CharField(label='Name', max_length=100) email = forms.EmailField(label='Kontakt Email') motivation = forms.CharField(label='Motivation') + captcha = CaptchaField() class QuestionForm(forms.Form): subject = forms.CharField(label='Thema', max_length=100) email = forms.EmailField(label='Kontakt Email') content = forms.CharField(label='Frage') + captcha = CaptchaField() # Create your views here. diff --git a/web_dev/sas_web/sas_web/settings.py b/web_dev/sas_web/sas_web/settings.py index e33ce38..46c7f50 100644 --- a/web_dev/sas_web/sas_web/settings.py +++ b/web_dev/sas_web/sas_web/settings.py @@ -43,6 +43,7 @@ USE_X_FORWARDED_HOST = True # Application definition INSTALLED_APPS = ( + 'captcha', 'datenbank', 'meingoethopia', 'startpage', diff --git a/web_dev/sas_web/sas_web/urls.py b/web_dev/sas_web/sas_web/urls.py index bd7bc0e..3992b6d 100644 --- a/web_dev/sas_web/sas_web/urls.py +++ b/web_dev/sas_web/sas_web/urls.py @@ -27,5 +27,6 @@ urlpatterns += [ url(r'^datenbank/', include('datenbank.urls', app_name='datenbank', namespace='datenbank')), url(r'^admin/', include(admin.site.urls)), + url(r'^captcha/', include('captcha.urls')), url(r'^', include('startpage.urls', namespace='startpage', app_name='startpage')) ]