Return the scheduled_for datetime in the DATETIME_FORMAT from the post_notification

This commit is contained in:
Rebecca Law
2017-05-16 09:57:58 +01:00
parent f0e2713bef
commit a6529d2723
2 changed files with 19 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
from datetime import datetime
from app import DATETIME_FORMAT
from app.models import NOTIFICATION_STATUS_TYPES, TEMPLATE_TYPES
from app.schema_validation.definitions import (uuid, personalisation)
@@ -203,7 +204,8 @@ def create_post_sms_response_from_notification(notification, body, from_number,
"template": __create_template_from_notification(notification=notification,
url_root=url_root,
service_id=service_id),
"scheduled_for": scheduled_for
"scheduled_for": datetime.strptime(scheduled_for,
"%Y-%m-%d %H:%M:%S").strftime(DATETIME_FORMAT) if scheduled_for else None
}
@@ -221,7 +223,8 @@ def create_post_email_response_from_notification(notification, content, subject,
"template": __create_template_from_notification(notification=notification,
url_root=url_root,
service_id=service_id),
"scheduled_for": scheduled_for
"scheduled_for": datetime.strptime(scheduled_for,
"%Y-%m-%d %H:%M:%S").strftime(DATETIME_FORMAT) if scheduled_for else None
}