mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 00:30:04 -04:00
Use new properties of utils Templates
We’ve added some new properties to the templates in utils that we can use instead of doing weird things like `WithSubjectTemplate.__str__(another_instance)`
This commit is contained in:
@@ -1513,16 +1513,16 @@ class Notification(db.Model):
|
||||
|
||||
@property
|
||||
def content(self):
|
||||
from app.utils import get_template_instance
|
||||
template_object = get_template_instance(self.template.__dict__, self.personalisation)
|
||||
return str(template_object)
|
||||
return self.template._as_utils_template_with_personalisation(
|
||||
self.personalisation
|
||||
).content_with_placeholders_filled_in
|
||||
|
||||
@property
|
||||
def subject(self):
|
||||
from app.utils import get_template_instance
|
||||
if self.notification_type != SMS_TYPE:
|
||||
template_object = get_template_instance(self.template.__dict__, self.personalisation)
|
||||
return template_object.subject
|
||||
template_object = self.template._as_utils_template_with_personalisation(
|
||||
self.personalisation
|
||||
)
|
||||
return getattr(template_object, 'subject', None)
|
||||
|
||||
@property
|
||||
def formatted_status(self):
|
||||
|
||||
Reference in New Issue
Block a user