Update TO route helper function to catch error and display flash message when a user tries to save a TO with an existing number.

Update TaskOrderForm so that it converts empty string for number into None, this was causing an issue where new TOs were being saved with an empty string for the number, which violated the unique constraint.
This commit is contained in:
leigh-mil
2019-12-12 14:21:30 -05:00
parent 9caef2883a
commit 78ef47f649
6 changed files with 70 additions and 20 deletions

View File

@@ -165,6 +165,11 @@ MESSAGES = {
"message_template": translate("task_orders.form.draft_alert_message"),
"category": "warning",
},
"task_order_number_error": {
"title_template": "",
"message_template": """{{ 'flash.task_order_number_error.message' | translate({ 'to_number': to_number }) }}""",
"category": "error",
},
"task_order_submitted": {
"title_template": "Your Task Order has been uploaded successfully.",
"message_template": """