diff --git a/hpst/forms.py b/hpst/forms.py index 658fab4..ad7a2fd 100644 --- a/hpst/forms.py +++ b/hpst/forms.py @@ -3,6 +3,7 @@ from django import forms class KontaktForm(forms.Form): subject = forms.CharField(widget=forms.HiddenInput()) + stack = forms.CharField(widget=forms.HiddenInput()) from_email = forms.EmailField(required=True, widget= forms.EmailInput (attrs={'class':'w3-input w3-border', @@ -16,3 +17,34 @@ class KontaktForm(forms.Form): widget=forms.Textarea (attrs={'class':'w3-input w3-border', 'placeholder':'Mitteilung'})) + url = forms.CharField(max_length=200, + required=False, + widget= forms.TextInput + (attrs={'class':'w3-input w3-border W3-CleaR','' + 'placeholder':'Url'})) + + def clean(self): + data = super(KontaktForm, self).clean() + url=data.get('url') + if url: + raise forms.ValidationError('Fehler in der URL!', code='invalid') + stackstr = data.get('stack') + stack=stackstr.split(',') + if not stack: + raise forms.ValidationError('Fehler im Stack!', code='invalid') + ktime=0 + ltime=0 + tdiff=0 + for s in stack: + #print (s) + if s[0]=='k': + if(ltime == 0): + ltime=int(s[1:]) + else: + ktime=int(s[1:]) + tdiff+=(ktime-ltime) + ltime=ktime + #print (tdiff) + if(tdiff<10000): + raise forms.ValidationError('Formular wurde zu schnell verarbeitet', code='invalid') + return data diff --git a/hpst/static/css/sinnes-tau.css b/hpst/static/css/sinnes-tau.css index bc1adb3..49c5ee9 100644 --- a/hpst/static/css/sinnes-tau.css +++ b/hpst/static/css/sinnes-tau.css @@ -15,3 +15,12 @@ body, html { font-size: 15px; } +.W3-CleaR{ + opacity: 0; + position: absolute; + top: 0; + left: 0; + height: 0; + width: 0; + z-index: -1;} + diff --git a/hpst/templates/email.html b/hpst/templates/email.html index 6ac98d9..4c4ad83 100644 --- a/hpst/templates/email.html +++ b/hpst/templates/email.html @@ -14,11 +14,10 @@
{{message.text}}
{% if form %} diff --git a/hpst/templates/kontaktformular.html b/hpst/templates/kontaktformular.html index 6f1b7fc..f43d7ee 100644 --- a/hpst/templates/kontaktformular.html +++ b/hpst/templates/kontaktformular.html @@ -17,7 +17,7 @@ {% endif %} -