diff --git a/djrill/mail/backends/djrill.py b/djrill/mail/backends/djrill.py index 0828b37..7998ac4 100644 --- a/djrill/mail/backends/djrill.py +++ b/djrill/mail/backends/djrill.py @@ -76,9 +76,8 @@ class DjrillBackend(BaseEmailBackend): if hasattr(message, 'template_name'): api_url = self.api_send_template api_params['template_name'] = message.template_name - if hasattr(message, 'template_content'): - api_params['template_content'] = \ - self._expand_merge_vars(message.template_content) + api_params['template_content'] = \ + self._expand_merge_vars(getattr(message, 'template_content', {})) response = requests.post(api_url, data=json.dumps(api_params)) diff --git a/djrill/tests/test_mandrill_send_template.py b/djrill/tests/test_mandrill_send_template.py index 51d0190..ed987b9 100644 --- a/djrill/tests/test_mandrill_send_template.py +++ b/djrill/tests/test_mandrill_send_template.py @@ -36,7 +36,7 @@ class DjrillMandrillSendTemplateTests(DjrillBackendMockAPITestCase): self.assert_mandrill_called("/messages/send-template.json") data = self.get_api_call_data() self.assertEqual(data['template_name'], "WELCOME_MESSAGE") - self.assertFalse('template_content' in data) + self.assertEqual(data['template_content'], []) # Mandrill requires this field def test_non_template_send(self): # Make sure the non-template case still uses /messages/send.json