from eventos.models import Palestrante, Trabalho, TipoTrabalho, Trilha, Evento, Improve
from eventos.forms import RegisterSpeaker
from django.db.models import Q
+import smtplib
forbidden = \
HttpResponseForbidden('<h2>You are not allowed to do this action.<h2>')
if cleaned['trabalho'].evento.id != event.id:
return forbidden
+ emails = [i.email for i in speakers]
+ user = cleaned['usuario'].get_full_name()
+ comments = cleaned['comentario']
+ msg = (u"From: emsl@minaslivre.org\r\nTo: %s\r\n"
+ u"Subject: Comentário em seu Trabalho EMSL 2008\r\n"
+ u"Content-Type: text/plain; charset=utf-8\r\n"
+ u"\r\n %s comentou seu trabalho.\r\n%s\r\r\n"
+ % (", ".join(emails), user, comments))
+ smtp = smtplib.SMTP("localhost")
+ smtp.sendmail("emsl@minaslivre.org", emails, str(msg.encode("utf8")))
+ smtp.quit()
+
instance = form.save()
return HttpResponseRedirect('/improve/%d/' % talk.id)