diff --git a/hpst/templates/index.html b/hpst/templates/index.html
index 594f1be..be0bff3 100644
--- a/hpst/templates/index.html
+++ b/hpst/templates/index.html
@@ -235,43 +235,11 @@ Kronach / Fischbach
Email: info@sinnes-tau.de
Komme auf eine Tasse vorbei, oder hinterlasse mir eine Nachricht:
- {% if form.errors %}
- {% for field in form %}
- {% for error in field.errors %}
-
-
Eingabefehler!
-
{{ error|escape }}
-
-
- {% endfor %}
- {% endfor %}
- {% for error in form.non_field_errors %}
-
-
Eingabefehler!
-
{{ error|escape }}
-
- {% endfor %}
- {% endif %}
-
-
+ {% if form %}
+ {% include "kontaktformular.html" %}
+ {% endif %}
+
diff --git a/hpst/templates/kontaktformular.html b/hpst/templates/kontaktformular.html
new file mode 100644
index 0000000..6f1b7fc
--- /dev/null
+++ b/hpst/templates/kontaktformular.html
@@ -0,0 +1,37 @@
+ {% if form.errors %}
+ {% for field in form %}
+ {% for error in field.errors %}
+
+
Eingabefehler!
+
{{ error|escape }}
+
+
+ {% endfor %}
+ {% endfor %}
+ {% for error in form.non_field_errors %}
+
+
Eingabefehler!
+
{{ error|escape }}
+
+ {% endfor %}
+ {% endif %}
+
+
+
diff --git a/hpst/templates/lamatour.html b/hpst/templates/lamatour.html
index a0ccdd0..f60bf2b 100644
--- a/hpst/templates/lamatour.html
+++ b/hpst/templates/lamatour.html
@@ -94,5 +94,11 @@ function showDivs(n) {
{% endfor %}
+ {% if form %}
+
+
Wenn Sie eine Lamatour wünschen können Sie hier Kontakt mit mir aufnehmen.
+ {% include "kontaktformular.html" %}
+
{% endblock %}
diff --git a/hpst/views.py b/hpst/views.py
index 39777bd..9951bbc 100644
--- a/hpst/views.py
+++ b/hpst/views.py
@@ -43,6 +43,7 @@ def lamatour(request):
termine=Termin.objects.filter(date__gt=timezone.now()).filter(termintyp='L').order_by( 'date')
context ={
"termine":termine,
+ "form":KontaktForm(initial={'subject': 'Kontaktformular - Lamatour - sinnestau.de',})
}
# return response with template and context
return render(request, "lamatour.html", context)
@@ -111,11 +112,11 @@ def contactView(request):
if request.method == 'GET':
form = KontaktForm()
else:
- print("havepost")
+ #print("havepost")
r_message=""
form = KontaktForm(request.POST)
if form.is_valid():
- print("form valid")
+ #print("form valid")
subject = form.cleaned_data['subject']
from_email = form.cleaned_data['from_email']
message = form.cleaned_data['message']
diff --git a/sinnestau/settings.py b/sinnestau/settings.py
index 675a1c2..b616c3f 100644
--- a/sinnestau/settings.py
+++ b/sinnestau/settings.py
@@ -13,7 +13,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
from pathlib import Path
#Pw etc
from decouple import config
-from dj_database_url import parse as db_url
+#from dj_database_url import parse as db_url
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent