Postmark: Fix API error with template but no merge data

Fixes #223
This commit is contained in:
medmunds
2021-02-22 17:46:39 -08:00
committed by Mike Edmunds
parent fd9fdb9b03
commit 9ed5ce0213
3 changed files with 20 additions and 2 deletions

View File

@@ -301,6 +301,10 @@ class PostmarkPayload(RequestsPayload):
except ValueError:
self.data["TemplateAlias"] = template_id
# Postmark requires TemplateModel (empty ok) when TemplateId/TemplateAlias
# specified. (This may get overwritten by a real TemplateModel later.)
self.data.setdefault("TemplateModel", {})
# Subject, TextBody, and HtmlBody aren't allowed with TemplateId;
# delete Django default subject and body empty strings:
for field in ("Subject", "TextBody", "HtmlBody"):