Browse Source

email 2

master
corbreedy 4 years ago
parent
commit
e05cbd06c1
  1. 40
      hpst/templates/index.html
  2. 37
      hpst/templates/kontaktformular.html
  3. 6
      hpst/templates/lamatour.html
  4. 5
      hpst/views.py
  5. 2
      sinnestau/settings.py

40
hpst/templates/index.html

@ -235,43 +235,11 @@ Kronach / Fischbach<br>
<i class="fa fa-envelope fa-fw w3-hover-text-black w3-xlarge w3-margin-right"></i> Email: info@sinnes-tau.de<br>
</div>
<p>Komme auf eine Tasse <i class="fa fa-coffee"></i> vorbei, oder hinterlasse mir eine Nachricht:</p>
{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}
<div class="w3-panel w3-yellow">
<h3>Eingabefehler!</h3>
<p>{{ error|escape }}</p>
</div>
{% endfor %}
{% endfor %}
{% for error in form.non_field_errors %}
<div class="w3-panel w3-yellow">
<h3>Eingabefehler!</h3>
<p>{{ error|escape }}</p>
</div>
{% endfor %}
{% endif %}
<form action="{% url 'kontakt' %}" method="Post">
{% csrf_token %}
{% for hidden_field in form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
<div class="w3-row-padding" style="margin:0 -16px 8px -16px">
<div class="w3-half">
{{ form.name }}
</div>
<div class="w3-half">
{{ form.from_email }}
</div>
</div>
{{ form.message }}
<button class="w3-button w3-black w3-right w3-section" type="submit">
<i class="fa fa-paper-plane"></i> ABSENDEN
</button>
</form>
{% if form %}
{% include "kontaktformular.html" %}
{% endif %}
</div>
</div>
</div>

37
hpst/templates/kontaktformular.html

@ -0,0 +1,37 @@
{% if form.errors %}
{% for field in form %}
{% for error in field.errors %}
<div class="w3-panel w3-yellow">
<h3>Eingabefehler!</h3>
<p>{{ error|escape }}</p>
</div>
{% endfor %}
{% endfor %}
{% for error in form.non_field_errors %}
<div class="w3-panel w3-yellow">
<h3>Eingabefehler!</h3>
<p>{{ error|escape }}</p>
</div>
{% endfor %}
{% endif %}
<form action="{% url 'kontakt' %}" method="Post">
{% csrf_token %}
{% for hidden_field in form.hidden_fields %}
{{ hidden_field }}
{% endfor %}
<div class="w3-row-padding" style="margin:0 -16px 8px -16px">
<div class="w3-half">
{{ form.name }}
</div>
<div class="w3-half">
{{ form.from_email }}
</div>
</div>
{{ form.message }}
<button class="w3-button w3-black w3-right w3-section" type="submit">
<i class="fa fa-paper-plane"></i> ABSENDEN
</button>
</form>

6
hpst/templates/lamatour.html

@ -94,5 +94,11 @@ function showDivs(n) {
{% endfor %}
</ul>
</div>
{% if form %}
<div class="w3-content w3-container">
<h4>Wenn Sie eine Lamatour wünschen können Sie hier Kontakt mit mir aufnehmen.</h4>
{% include "kontaktformular.html" %}
</div
{% endif %}
</div>
{% endblock %}

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

2
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

Loading…
Cancel
Save