- extra column in events grid with location & time
- bugfixes in locationwidget
- prepared email notifications
This commit is contained in:
Martin Bauer
2013-11-01 12:42:57 +01:00
parent cd635aff9b
commit 82de9eaa84
56 changed files with 800 additions and 44 deletions

View File

@@ -18,4 +18,39 @@ class Message ( models.Model ):
return self.author.username + " : " + self.titel
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.mail import EmailMultiAlternatives
from musicians.models import Musician
from django.template.loader import get_template
from django.template import Context
@receiver(post_save, sender=Message)
def my_handler(sender, instance, created, **kwargs):
if not created:
return
receivers = [ m.user.email for m in Musician.objects.all() ]
# overwrite only to me for now
receivers = [ 'martinbauer86@gmail.com' ]
subject = "Blechreiz Forum: " + instance.titel
from_email = 'forum@blechreiz.com'
c = { 'messages': Message.objects.all().order_by('-creation_time')[:10] }
text_template = get_template( "simpleforum/mail.txt" )
html_template = get_template( "simpleforum/mail.html" )
text_content = text_template.render( Context(c) )
#html_content = html_template.render( Context(c) )
msg = EmailMultiAlternatives( subject, text_content, from_email, receivers )
#msg.attach_alternative( html_content, "text/html" )
msg.send()