From a93cb0615b3136de2dd88d011455a1a09a8e1228 Mon Sep 17 00:00:00 2001 From: Sanjay B Date: Thu, 2 May 2013 11:20:05 +0530 Subject: [PATCH] oops, forgot to add events/views.py --- itf/events/views.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 itf/events/views.py diff --git a/itf/events/views.py b/itf/events/views.py new file mode 100644 index 0000000..746828b --- /dev/null +++ b/itf/events/views.py @@ -0,0 +1,21 @@ +from django.http import HttpResponse +from django.core.mail import send_mail + + +def contact_person(request): + frm = request.user.email + to_event = request.GET.get("to", None) + try: + to = Event.objects.get(pk=to_person) + except: + return HttpResponse("An error occurred. Please contact contact@theatreforum.in and let us know. Thanks.") + message = request.GET.get("message", None) + if not message: + return HttpResponse("Please enter a message.") + if not to.user: + return HttpResponse("Sorry, person does not have an email address associated on the site.") + else: + to_email = to.user.email + send_mail("Contact about event %s" % to.title, message, frm, [to_email]) + return HttpResponse("Your message has been sent, thanks.") +