Allow specifying custom actions in flashed messages

This commit is contained in:
Patrick Smith
2019-01-17 08:47:23 -05:00
parent 1ee0c11a63
commit d495619cb6
2 changed files with 5 additions and 2 deletions

View File

@@ -115,4 +115,7 @@ def formatted_flash(message_name, **message_args):
config = MESSAGES[message_name]
title = render_template_string(config["title_template"], **message_args)
message = render_template_string(config["message_template"], **message_args)
flash({"title": title, "message": message}, config["category"])
actions = None
if "actions" in config:
actions = render_template_string(config["actions"], **message_args)
flash({"title": title, "message": message, "actions": actions}, config["category"])