oops, forgot to add events/views.py

This commit is contained in:
Sanjay B 2013-05-02 11:20:05 +05:30
parent 19d580c296
commit a93cb0615b

21
itf/events/views.py Normal file
View File

@ -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.")