Changeset - bd2fd5338d8d
[Not reviewed]
0 3 0
Brian Rosner - 12 years ago 2012-09-09 01:38:57
brosner@gmail.com
added DTL handling of email body
3 files changed with 14 insertions and 8 deletions:
0 comments (0 inline, 0 general)
symposion/proposals/models.py
Show inline comments
...
 
@@ -122,6 +122,13 @@ class ProposalBase(models.Model):
 
        yield self.speaker
 
        for speaker in self.additional_speakers.exclude(additionalspeaker__status=AdditionalSpeaker.SPEAKING_STATUS_DECLINED):
 
            yield speaker
 
    
 
    def notification_email_context(self):
 
        return {
 
            "title": self.title,
 
            "speaker": self.speaker.name,
 
            "kind": self.kind.name,
 
        }
 

	
 

	
 
reversion.register(ProposalBase)
symposion/reviews/models.py
Show inline comments
...
 
@@ -289,13 +289,7 @@ class NotificationTemplate(models.Model):
 
    label = models.CharField(max_length=100)
 
    from_address = models.EmailField()
 
    subject = models.CharField(max_length=100)
 
    body = models.TextField(
 
        help_text=(
 
            "If the <b>Body</b> includes the string <code>{{ proposal }}</code> "
 
            "then it will be replaced with the title of the proposal when the "
 
            "email is sent."
 
        )
 
    )
 
    body = models.TextField()
 

	
 

	
 
class ResultNotification(models.Model):
symposion/reviews/views.py
Show inline comments
...
 
@@ -4,6 +4,7 @@ from django.core.mail import send_mass_mail
 
from django.db.models import Q
 
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
 
from django.shortcuts import render, redirect, get_object_or_404
 
from django.template import Context, Template
 
from django.views.decorators.http import require_POST
 

	
 
from django.contrib.auth.decorators import login_required
...
 
@@ -472,7 +473,11 @@ def result_notification_send(request, section_slug, status):
 
        rn.to_address = proposal.speaker_email
 
        rn.from_address = request.POST["from_address"]
 
        rn.subject = request.POST["subject"]
 
        rn.body = re.sub(r"{{\s*proposal\s*}}", proposal.title, request.POST["body"])
 
        rn.body = Template(request.POST["body"]).render(
 
            Context({
 
                "proposal": proposal.notification_email_context()
 
            })
 
        )
 
        rn.save()
 
        emails.append(rn.email_args)
 
    
0 comments (0 inline, 0 general)