added from_address to NotificationTemplate and prepare form

This commit is contained in:
Brian Rosner 2012-09-08 19:10:06 -06:00
parent 23b31b7973
commit ecfabd5b70
3 changed files with 6 additions and 2 deletions

View file

@ -287,6 +287,7 @@ class Comment(models.Model):
class NotificationTemplate(models.Model): class NotificationTemplate(models.Model):
label = models.CharField(max_length=100) label = models.CharField(max_length=100)
from_address = models.EmailField()
subject = models.CharField(max_length=100) subject = models.CharField(max_length=100)
body = models.TextField( body = models.TextField(
help_text=( help_text=(

View file

@ -441,7 +441,7 @@ def result_notification_send(request, section_slug, status):
if not request.user.has_perm("reviews.can_manage_%s" % section_slug): if not request.user.has_perm("reviews.can_manage_%s" % section_slug):
return access_not_permitted(request) return access_not_permitted(request)
if not all([k in request.POST for k in ["proposal_pks", "subject", "body"]]): if not all([k in request.POST for k in ["proposal_pks", "from_address", "subject", "body"]]):
return HttpResponseBadRequest() return HttpResponseBadRequest()
try: try:
@ -470,7 +470,7 @@ def result_notification_send(request, section_slug, status):
rn.proposal = proposal rn.proposal = proposal
rn.template = notification_template rn.template = notification_template
rn.to_address = proposal.speaker_email rn.to_address = proposal.speaker_email
rn.from_address = settings.DEFAULT_FROM_EMAIL rn.from_address = request.POST["from_address"]
rn.subject = request.POST["subject"] rn.subject = request.POST["subject"]
rn.body = re.sub(r"{{\s*proposal\s*}}", proposal.title, request.POST["body"]) rn.body = re.sub(r"{{\s*proposal\s*}}", proposal.title, request.POST["body"])
rn.save() rn.save()

View file

@ -27,6 +27,9 @@
{% csrf_token %} {% csrf_token %}
<label>From Address</label>
<input type="text" name="from_address" class="span5" value="{{ notification_template.from_address }}" />
<br/>
<label>Subject</label> <label>Subject</label>
<input type="text" name="subject" class="span5" value="{{ notification_template.subject }}" /> <input type="text" name="subject" class="span5" value="{{ notification_template.subject }}" />
<br/> <br/>