This commit is contained in:
j 2021-10-26 16:51:56 +01:00
parent d5bd8d2da8
commit f7a374877a
2 changed files with 5 additions and 0 deletions

View file

@ -15,6 +15,7 @@ def index(request):
to = settings.CONTACT_TO_EMAIL
msg = EmailMessage(subject, message, from_, to, reply_to=[form.cleaned_data['email']])
msg.send(fail_silently=True)
context['submitted'] = True
else:
context['form'] = form
return render(request, 'contact.html', context)

View file

@ -3,6 +3,9 @@
{% block body_class%}animated animated-text{% endblock %}
{% block main %}
<div class="contact">
{% if submitted %}
Thanks for your message
{% else %}
<h1>Contact 聯絡</h1>
<form method="post">
<label>
@ -17,6 +20,7 @@
<input type="submit" value="Send Message">
{% csrf_token %}
</form>
{% endif %}
</div>
{% endblock %}