add redact to notification with template schema.

So that when the admin gets notifications, the template they return
also has a "redact_personalisation" boolean attached to it. Note, it
won't do the redacting on the api - that'll be part of the admin.

Under the hood, this uses an association_proxy, which is essentially
black magic. But it proxies the `redact_personalisation` property of
`TemplateRedacted` onto the `Template` object, so that Marshmallow
can pick it up.

Note: NOT currently added to NotificationWithTemplateHistory
This commit is contained in:
Leo Hemsted
2017-06-28 16:10:22 +01:00
parent 29fc81090e
commit bd71ee9d02
3 changed files with 44 additions and 2 deletions

View File

@@ -443,6 +443,8 @@ class Template(db.Model):
default=NORMAL
)
redact_personalisation = association_proxy('template_redacted', 'redact_personalisation')
def get_link(self):
# TODO: use "/v2/" route once available
return url_for(