diff --git a/tailbone/templates/settings/email/view.mako b/tailbone/templates/settings/email/view.mako index 2e9f4325..fa3cb142 100644 --- a/tailbone/templates/settings/email/view.mako +++ b/tailbone/templates/settings/email/view.mako @@ -1,4 +1,4 @@ -## -*- coding: utf-8 -*- +## -*- coding: utf-8; -*- <%inherit file="/master/view.mako" /> <%def name="head_tags()"> @@ -21,8 +21,9 @@ ${parent.body()} -${h.form(url('email.preview'), name='send-email-preview')} +${h.form(url('email.preview'), name='send-email-preview', class_='autodisable')} ${h.csrf_token(request)} + ${h.hidden('email_key', value=instance['key'])} ${h.link_to("Preview HTML", '{}?key={}&type=html'.format(url('email.preview'), instance['key']), id='preview-html', class_='button', target='_blank')} ${h.link_to("Preview TXT", '{}?key={}&type=txt'.format(url('email.preview'), instance['key']), id='preview-txt', class_='button', target='_blank')} or diff --git a/tailbone/views/email.py b/tailbone/views/email.py index f9a3516d..a2fd52cd 100644 --- a/tailbone/views/email.py +++ b/tailbone/views/email.py @@ -280,9 +280,7 @@ class EmailPreview(View): def email_template(self): recipient = self.request.POST.get('recipient') if recipient: - keys = [key for key in self.request.POST.keys() - if key.startswith('send_')] - key = keys[0][5:] if keys else None + key = self.request.POST.get('email_key') if key: email = mail.get_email(self.rattail_config, key) data = email.sample_data(self.request)