added from_address to NotificationTemplate and prepare form
This commit is contained in:
parent
23b31b7973
commit
ecfabd5b70
3 changed files with 6 additions and 2 deletions
|
@ -287,6 +287,7 @@ class Comment(models.Model):
|
|||
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=(
|
||||
|
|
|
@ -441,7 +441,7 @@ def result_notification_send(request, section_slug, status):
|
|||
if not request.user.has_perm("reviews.can_manage_%s" % section_slug):
|
||||
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()
|
||||
|
||||
try:
|
||||
|
@ -470,7 +470,7 @@ def result_notification_send(request, section_slug, status):
|
|||
rn.proposal = proposal
|
||||
rn.template = notification_template
|
||||
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.body = re.sub(r"{{\s*proposal\s*}}", proposal.title, request.POST["body"])
|
||||
rn.save()
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
{% csrf_token %}
|
||||
|
||||
<label>From Address</label>
|
||||
<input type="text" name="from_address" class="span5" value="{{ notification_template.from_address }}" />
|
||||
<br/>
|
||||
<label>Subject</label>
|
||||
<input type="text" name="subject" class="span5" value="{{ notification_template.subject }}" />
|
||||
<br/>
|
||||
|
|
Loading…
Reference in a new issue