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
...
 
@@ -124,2 +124,9 @@ class ProposalBase(models.Model):
 
            yield speaker
 
    
 
    def notification_email_context(self):
 
        return {
 
            "title": self.title,
 
            "speaker": self.speaker.name,
 
            "kind": self.kind.name,
 
        }
 

	
symposion/reviews/models.py
Show inline comments
...
 
@@ -291,9 +291,3 @@ class NotificationTemplate(models.Model):
 
    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()
 

	
symposion/reviews/views.py
Show inline comments
...
 
@@ -6,2 +6,3 @@ 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
...
 
@@ -474,3 +475,7 @@ def result_notification_send(request, section_slug, status):
 
        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()
0 comments (0 inline, 0 general)