From 4e3c41d5d78ba89c985ce7a31d3530a691bd8793 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Sat, 20 Jun 2015 17:43:55 +0530 Subject: change to give query sent consent --- website/templates/base.html | 12 ++++++++++-- website/urls.py | 1 - website/views.py | 21 +++++++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'website') 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 @@
- {% if query %} + {% if mailsent %} {% endif %} + {% if mailfailed %} + + {% endif %}

SciPy India 2015


@@ -177,7 +185,7 @@

Feel free to drop us a mail regarding any of the queries that you might have.

-
+
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 @@ -12,16 +12,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": @@ -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) -- cgit