summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorhardythe12015-06-20 17:43:55 +0530
committerhardythe12015-06-20 17:43:55 +0530
commit4e3c41d5d78ba89c985ce7a31d3530a691bd8793 (patch)
treef412d8fd1a9f10d8fc254d485c76960b68c4106f /website
parentbbe849ca534d2573f9815e8c44c890f1834adf4f (diff)
downloadSciPy2015-4e3c41d5d78ba89c985ce7a31d3530a691bd8793.tar.gz
SciPy2015-4e3c41d5d78ba89c985ce7a31d3530a691bd8793.tar.bz2
SciPy2015-4e3c41d5d78ba89c985ce7a31d3530a691bd8793.zip
change to give query sent consent
Diffstat (limited to 'website')
-rw-r--r--website/templates/base.html12
-rw-r--r--website/urls.py1
-rw-r--r--website/views.py21
3 files changed, 17 insertions, 17 deletions
diff --git a/website/templates/base.html b/website/templates/base.html
index 7d48179..02a238b 100644
--- a/website/templates/base.html
+++ b/website/templates/base.html
@@ -57,7 +57,7 @@
<!-- ==== HEADERWRAP ==== -->
<div id="headerwrap" name="home">
- {% if query %}
+ {% if mailsent %}
<div class="alert alert-success" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
@@ -65,6 +65,14 @@
<p>Thank You for contacting us. We will get back to you soon !</p>
</div>
{% endif %}
+ {% if mailfailed %}
+ <div class="alert alert-danger" role="alert">
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ <p>Sorry ! There seems to be some problem with our mail server, we could not send your query. While we solve it, you may write to us at scipy[at]fossee[dot]in.</p>
+ </div>
+ {% endif %}
<header class="clearfix"> <center> <img class="img-responsive" height=300 width=300 src="{% static 'img/scipy.png' %}" alt=""></center>
<h1>SciPy India 2015</h1>
<hr>
@@ -177,7 +185,7 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2 centered">
<p>Feel free to drop us a mail regarding any of the queries that you might have.</p>
- <form id="contact" action="{% url 'website:contact' %}" class="form" role="form" method=POST enctype="multipart/form-data">
+ <form id="contact" action="{% url 'website:home' %}" class="form" role="form" method=POST enctype="multipart/form-data">
<div class="row">
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="name" placeholder="Name" type="text" required />
diff --git a/website/urls.py b/website/urls.py
index fcc3156..b399a2b 100644
--- a/website/urls.py
+++ b/website/urls.py
@@ -3,5 +3,4 @@ from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'website.views.home', name='home'),
- url(r'^contact/', 'website.views.contact', name='contact'),
)
diff --git a/website/views.py b/website/views.py
index 0fda4f7..2fcca04 100644
--- a/website/views.py
+++ b/website/views.py
@@ -13,16 +13,6 @@ from django.core.mail import send_mail
def home(request):
context = {}
- if 'query' in request.GET:
- context['query'] = True
- context.update(csrf(request))
- if request.method == "POST":
- return HttpResponse("Working")
- return render_to_response('base.html', context)
-
-
-def contact(request):
- context = {}
context.update(csrf(request))
if request.method == "POST":
sender_name = request.POST['name']
@@ -31,7 +21,10 @@ def contact(request):
to = ('scipy@fossee.in',)
subject = "Query from - "+sender_name
message = request.POST['message']
- send_mail(subject, message, sender_email, to, fail_silently=True)
- return HttpResponseRedirect('/2015/?query=sent')
- else:
- return HttpResponseRedirect('/2015')
+ try:
+ send_mail(subject, message, sender_email, to)
+ context['mailsent'] = True
+ except:
+ context['mailfailed'] = True
+ return render_to_response('base.html', context)
+ return render_to_response('base.html', context)