mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Add TemplateHistory.get_link method
Notifications.serialize calls `Notifications.template.get_link`, so we need TemplateHistory objects to generate their API URLs. This generates a link to the `/v2/` version of the endpoint.
This commit is contained in:
@@ -645,6 +645,14 @@ class TemplateHistory(db.Model):
|
||||
nullable=False,
|
||||
default=NORMAL)
|
||||
|
||||
def get_link(self):
|
||||
return url_for(
|
||||
"v2_template.get_template_by_id",
|
||||
template_id=self.id,
|
||||
version=self.version,
|
||||
_external=True
|
||||
)
|
||||
|
||||
def _as_utils_template(self):
|
||||
return Template._as_utils_template(self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user