Added ResultNotification to admin, fixed subject as template
This commit is contained in:
parent
420d8ec870
commit
c7608fb0d5
3 changed files with 9 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from symposion.reviews.models import NotificationTemplate, ProposalResult
|
||||
from symposion.reviews.models import NotificationTemplate, ProposalResult, ResultNotification
|
||||
|
||||
|
||||
admin.site.register(
|
||||
|
@ -16,3 +16,5 @@ admin.site.register(
|
|||
ProposalResult,
|
||||
list_display=['proposal', 'status', 'score', 'vote_count', 'accepted']
|
||||
)
|
||||
|
||||
admin.site.register(ResultNotification)
|
|
@ -349,6 +349,9 @@ class ResultNotification(models.Model):
|
|||
for speaker in self.proposal.speakers():
|
||||
yield speaker.email
|
||||
|
||||
def __unicode__(self):
|
||||
return self.proposal.title + ' ' + self.timestamp.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
@property
|
||||
def email_args(self):
|
||||
return (self.subject, self.body, self.from_address, self.recipients())
|
||||
|
|
|
@ -645,14 +645,15 @@ def result_notification_send(request, section_slug, status):
|
|||
rn.template = notification_template
|
||||
rn.to_address = proposal.speaker_email
|
||||
rn.from_address = request.POST["from_address"]
|
||||
proposal_context = proposal.notification_email_context()
|
||||
rn.subject = Template(request.POST["subject"]).render(
|
||||
Context({
|
||||
"proposal": proposal.notification_email_context()
|
||||
"proposal": proposal_context
|
||||
})
|
||||
)
|
||||
rn.body = Template(request.POST["body"]).render(
|
||||
Context({
|
||||
"proposal": proposal.notification_email_context()
|
||||
"proposal": proposal_context
|
||||
})
|
||||
)
|
||||
rn.save()
|
||||
|
|
Loading…
Reference in a new issue