thanks
This commit is contained in:
parent
d5bd8d2da8
commit
f7a374877a
2 changed files with 5 additions and 0 deletions
|
@ -15,6 +15,7 @@ def index(request):
|
||||||
to = settings.CONTACT_TO_EMAIL
|
to = settings.CONTACT_TO_EMAIL
|
||||||
msg = EmailMessage(subject, message, from_, to, reply_to=[form.cleaned_data['email']])
|
msg = EmailMessage(subject, message, from_, to, reply_to=[form.cleaned_data['email']])
|
||||||
msg.send(fail_silently=True)
|
msg.send(fail_silently=True)
|
||||||
|
context['submitted'] = True
|
||||||
else:
|
else:
|
||||||
context['form'] = form
|
context['form'] = form
|
||||||
return render(request, 'contact.html', context)
|
return render(request, 'contact.html', context)
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
{% block body_class%}animated animated-text{% endblock %}
|
{% block body_class%}animated animated-text{% endblock %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="contact">
|
<div class="contact">
|
||||||
|
{% if submitted %}
|
||||||
|
Thanks for your message
|
||||||
|
{% else %}
|
||||||
<h1>Contact 聯絡</h1>
|
<h1>Contact 聯絡</h1>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<label>
|
<label>
|
||||||
|
@ -17,6 +20,7 @@
|
||||||
<input type="submit" value="Send Message">
|
<input type="submit" value="Send Message">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
</form>
|
</form>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue