Hard code TO upload description into the UploadInput Macro

This is a temporary fix to avoid spending too much time trying to use app.config variables in a Form class field descriptions and labels. This is tech debt and should be fixed in the future.
This commit is contained in:
leigh-mil 2020-01-27 16:29:25 -05:00
parent 0c408bccfd
commit 745ce713b0
2 changed files with 6 additions and 13 deletions

View File

@ -26,7 +26,6 @@ from atst.utils.localization import translate
from flask import current_app as app
MAX_CLIN_AMOUNT = 1_000_000_000
FILE_SIZE_LIMIT = 25
def coerce_enum(enum_inst):
@ -163,17 +162,7 @@ class TaskOrderForm(BaseForm):
filters=[remove_empty_string, remove_dashes, coerce_upper],
validators=[AlphaNumeric(), Length(min=13, max=17), Optional()],
)
pdf = FormField(
AttachmentForm,
label=translate(
"task_orders.form.supporting_docs_size_limit",
{"file_size_limit": FILE_SIZE_LIMIT},
),
description=translate(
"task_orders.form.supporting_docs_size_limit",
{"file_size_limit": FILE_SIZE_LIMIT},
),
)
pdf = FormField(AttachmentForm)
clins = FieldList(FormField(CLINForm))

View File

@ -24,7 +24,11 @@
{{ field.label }}
{% endif %}
<p>
{{ field.description }}
<!-- TODO: fix this to use field.description -->
<!-- This was temporarily hard coded because we were unable to use
app.config['FILE_SIZE_LIMIT'] in TaskOrderForm field descriptions and labels -->
{% set size_limit = file_size_limit // 1000000 %}
{{ "task_orders.form.supporting_docs_size_limit" | translate({ "file_size_limit": size_limit }) }}
</p>
<div v-if="!hideInput" class="upload-widget">
<label class="upload-label" :for="name">