Formatting
This commit is contained in:
@@ -7,10 +7,7 @@ import pendulum
|
||||
class DateField(DateField):
|
||||
def _value(self):
|
||||
if self.data:
|
||||
date_formats = [
|
||||
"YYYY-MM-DD",
|
||||
"MM/DD/YYYY"
|
||||
]
|
||||
date_formats = ["YYYY-MM-DD", "MM/DD/YYYY"]
|
||||
for _format in date_formats:
|
||||
try:
|
||||
return pendulum.from_format(self.data, _format).date()
|
||||
|
@@ -12,13 +12,17 @@ from .fields import NewlineListField
|
||||
from .forms import ValidatedForm
|
||||
|
||||
|
||||
PE_REGEX = re.compile(r"""
|
||||
PE_REGEX = re.compile(
|
||||
r"""
|
||||
(0?\d) # program identifier
|
||||
(0?\d) # category
|
||||
(\d) # activity
|
||||
(\d+) # sponsor element
|
||||
(.+) # service
|
||||
""", re.X)
|
||||
""",
|
||||
re.X,
|
||||
)
|
||||
|
||||
|
||||
def suggest_pe_id(pe_id):
|
||||
suggestion = pe_id
|
||||
@@ -45,7 +49,7 @@ def validate_pe_id(field, existing_request, pe_numbers_repo):
|
||||
"We couldn't find that PE number. {}"
|
||||
"If you have double checked it you can submit anyway. "
|
||||
"Your request will need to go through a manual review."
|
||||
).format("Did you mean \"{}\"? ".format(suggestion) if suggestion else "")
|
||||
).format('Did you mean "{}"? '.format(suggestion) if suggestion else "")
|
||||
field.errors.append(error_str)
|
||||
return False
|
||||
|
||||
@@ -53,10 +57,9 @@ def validate_pe_id(field, existing_request, pe_numbers_repo):
|
||||
|
||||
|
||||
class FinancialForm(ValidatedForm):
|
||||
|
||||
def perform_extra_validation(self, existing_request, pe_numbers_repo):
|
||||
valid = True
|
||||
if not existing_request or existing_request.get('pe_id') != self.pe_id.data:
|
||||
if not existing_request or existing_request.get("pe_id") != self.pe_id.data:
|
||||
valid = yield validate_pe_id(self.pe_id, existing_request, pe_numbers_repo)
|
||||
return valid
|
||||
|
||||
@@ -68,9 +71,7 @@ class FinancialForm(ValidatedForm):
|
||||
"Unique Item Identifier (UII)s related to your application(s) if you already have them."
|
||||
)
|
||||
|
||||
pe_id = StringField(
|
||||
"Program Element (PE) Number related to your request"
|
||||
)
|
||||
pe_id = StringField("Program Element (PE) Number related to your request")
|
||||
|
||||
treasury_code = StringField("Program Treasury Code")
|
||||
|
||||
@@ -116,11 +117,13 @@ class FinancialForm(ValidatedForm):
|
||||
)
|
||||
|
||||
clin_0001 = StringField(
|
||||
"<dl><dt>CLIN 0001</dt> - <dd>Unclassified IaaS and PaaS Amount</dd></dl>", validators=[Required()]
|
||||
"<dl><dt>CLIN 0001</dt> - <dd>Unclassified IaaS and PaaS Amount</dd></dl>",
|
||||
validators=[Required()],
|
||||
)
|
||||
|
||||
clin_0003 = StringField(
|
||||
"<dl><dt>CLIN 0003</dt> - <dd>Unclassified Cloud Support Package</dd></dl>", validators=[Required()]
|
||||
"<dl><dt>CLIN 0003</dt> - <dd>Unclassified Cloud Support Package</dd></dl>",
|
||||
validators=[Required()],
|
||||
)
|
||||
|
||||
clin_1001 = StringField(
|
||||
|
@@ -4,7 +4,6 @@ from flask_wtf import FlaskForm
|
||||
|
||||
|
||||
class ValidatedForm(FlaskForm):
|
||||
|
||||
def perform_extra_validation(self, *args, **kwargs):
|
||||
"""Performs any applicable extra validation. Must
|
||||
return True if the form is valid or False otherwise."""
|
||||
|
@@ -8,30 +8,15 @@ from .validators import DateRange, PhoneNumber, Alphabet
|
||||
|
||||
|
||||
class OrgForm(ValidatedForm):
|
||||
fname_request = StringField(
|
||||
"First Name",
|
||||
validators=[Required(), Alphabet()]
|
||||
)
|
||||
fname_request = StringField("First Name", validators=[Required(), Alphabet()])
|
||||
|
||||
lname_request = StringField(
|
||||
"Last Name",
|
||||
validators=[Required(), Alphabet()]
|
||||
)
|
||||
lname_request = StringField("Last Name", validators=[Required(), Alphabet()])
|
||||
|
||||
email_request = EmailField(
|
||||
"Email Address",
|
||||
validators=[Required(), Email()]
|
||||
)
|
||||
email_request = EmailField("Email Address", validators=[Required(), Email()])
|
||||
|
||||
phone_number = TelField(
|
||||
"Phone Number",
|
||||
validators=[Required(), PhoneNumber()]
|
||||
)
|
||||
phone_number = TelField("Phone Number", validators=[Required(), PhoneNumber()])
|
||||
|
||||
service_branch = StringField(
|
||||
"Service Branch or Agency",
|
||||
validators=[Required()]
|
||||
)
|
||||
service_branch = StringField("Service Branch or Agency", validators=[Required()])
|
||||
|
||||
citizenship = RadioField(
|
||||
choices=[
|
||||
|
@@ -6,22 +6,12 @@ from .validators import IsNumber, Alphabet
|
||||
|
||||
|
||||
class POCForm(ValidatedForm):
|
||||
fname_poc = StringField(
|
||||
"POC First Name",
|
||||
validators=[Required()]
|
||||
)
|
||||
fname_poc = StringField("POC First Name", validators=[Required()])
|
||||
|
||||
lname_poc = StringField(
|
||||
"POC Last Name",
|
||||
validators=[Required()]
|
||||
)
|
||||
lname_poc = StringField("POC Last Name", validators=[Required()])
|
||||
|
||||
email_poc = EmailField(
|
||||
"POC Email Address",
|
||||
validators=[Required(), Email()]
|
||||
)
|
||||
email_poc = EmailField("POC Email Address", validators=[Required(), Email()])
|
||||
|
||||
dodid_poc = StringField(
|
||||
"DOD ID",
|
||||
validators=[Required(), Length(min=10), IsNumber()]
|
||||
"DOD ID", validators=[Required(), Length(min=10), IsNumber()]
|
||||
)
|
||||
|
@@ -14,18 +14,21 @@ class RequestForm(ValidatedForm):
|
||||
"DoD Component",
|
||||
description="Identify the DoD component that is requesting access to the JEDI Cloud",
|
||||
choices=[
|
||||
("null","Select an option"),
|
||||
("us_air_force","US Air Force"),
|
||||
("us_army","US Army"),
|
||||
("us_navy","US Navy"),
|
||||
("us_marine_corps","US Marine Corps"),
|
||||
("joint_chiefs_of_staff","Joint Chiefs of Staff")],
|
||||
("null", "Select an option"),
|
||||
("us_air_force", "US Air Force"),
|
||||
("us_army", "US Army"),
|
||||
("us_navy", "US Navy"),
|
||||
("us_marine_corps", "US Marine Corps"),
|
||||
("joint_chiefs_of_staff", "Joint Chiefs of Staff"),
|
||||
],
|
||||
)
|
||||
|
||||
jedi_usage = TextAreaField(
|
||||
"JEDI Usage",
|
||||
description="Briefly describe how you are expecting to use the JEDI Cloud",
|
||||
render_kw={"placeholder": "e.g. We are migrating XYZ application to the cloud so that..."},
|
||||
render_kw={
|
||||
"placeholder": "e.g. We are migrating XYZ application to the cloud so that..."
|
||||
},
|
||||
)
|
||||
|
||||
# Details of Use: Cloud Readiness
|
||||
@@ -41,7 +44,7 @@ class RequestForm(ValidatedForm):
|
||||
|
||||
rationalization_software_systems = RadioField(
|
||||
"Have you completed a “rationalization” of your software systems to move to the cloud?",
|
||||
choices=[("yes", "Yes"), ("no", "No"), ("in_progress","In Progress")],
|
||||
choices=[("yes", "Yes"), ("no", "No"), ("in_progress", "In Progress")],
|
||||
)
|
||||
|
||||
technical_support_team = RadioField(
|
||||
@@ -52,40 +55,43 @@ class RequestForm(ValidatedForm):
|
||||
organization_providing_assistance = RadioField( # this needs to be updated to use checkboxes instead of radio
|
||||
"If you are receiving migration assistance, indicate the type of organization providing assistance below:",
|
||||
choices=[
|
||||
("in_house_staff","In-house staff"),
|
||||
("contractor","Contractor"),
|
||||
("other_dod_organization","Other DoD organization")],
|
||||
("in_house_staff", "In-house staff"),
|
||||
("contractor", "Contractor"),
|
||||
("other_dod_organization", "Other DoD organization"),
|
||||
],
|
||||
)
|
||||
|
||||
engineering_assessment = RadioField(
|
||||
description="Have you completed an engineering assessment of your software systems for cloud readiness?",
|
||||
choices=[("yes", "Yes"), ("no", "No"), ("in_progress","In Progress")],
|
||||
choices=[("yes", "Yes"), ("no", "No"), ("in_progress", "In Progress")],
|
||||
)
|
||||
|
||||
data_transfers = SelectField(
|
||||
description="How much data is being transferred to the cloud?",
|
||||
choices=[
|
||||
("null","Select an option"),
|
||||
("less_than_100gb","Less than 100GB"),
|
||||
("100gb-500gb","100GB-500GB"),
|
||||
("500gb-1tb","500GB-1TB"),
|
||||
("1tb-50tb","1TB-50TB"),
|
||||
("50tb-100tb","50TB-100TB"),
|
||||
("100tb-500tb","100TB-500TB"),
|
||||
("500tb-1pb","500TB-1PB"),
|
||||
("1pb-5pb","1PB-5PB"),
|
||||
("5pb-10pb","5PB-10PB"),
|
||||
("above_10pb","Above 10PB")],
|
||||
("null", "Select an option"),
|
||||
("less_than_100gb", "Less than 100GB"),
|
||||
("100gb-500gb", "100GB-500GB"),
|
||||
("500gb-1tb", "500GB-1TB"),
|
||||
("1tb-50tb", "1TB-50TB"),
|
||||
("50tb-100tb", "50TB-100TB"),
|
||||
("100tb-500tb", "100TB-500TB"),
|
||||
("500tb-1pb", "500TB-1PB"),
|
||||
("1pb-5pb", "1PB-5PB"),
|
||||
("5pb-10pb", "5PB-10PB"),
|
||||
("above_10pb", "Above 10PB"),
|
||||
],
|
||||
)
|
||||
|
||||
expected_completion_date = SelectField(
|
||||
description="When do you expect to complete your migration to the JEDI Cloud?",
|
||||
choices=[
|
||||
("null","Select an option"),
|
||||
("less_than_1_month","Less than 1 month"),
|
||||
("1_to_3_months","1-3 months"),
|
||||
("3_to_6_months","3-6 months"),
|
||||
("above_12_months","Above 12 months")],
|
||||
("null", "Select an option"),
|
||||
("less_than_1_month", "Less than 1 month"),
|
||||
("1_to_3_months", "1-3 months"),
|
||||
("3_to_6_months", "3-6 months"),
|
||||
("above_12_months", "Above 12 months"),
|
||||
],
|
||||
)
|
||||
|
||||
cloud_native = RadioField(
|
||||
@@ -96,7 +102,7 @@ class RequestForm(ValidatedForm):
|
||||
# Details of Use: Financial Usage
|
||||
estimated_monthly_spend = IntegerField(
|
||||
"Estimated monthly spend",
|
||||
description="Use the <a href=\"#\">JEDI CSP Calculator</a> to estimate your monthly cloud resource usage and enter the dollar amount below. Note these estimates are for initial approval only. After the request is approved, you will be asked to provide a valid Task Order number with specific CLIN amounts for cloud services."
|
||||
description='Use the <a href="#">JEDI CSP Calculator</a> to estimate your monthly cloud resource usage and enter the dollar amount below. Note these estimates are for initial approval only. After the request is approved, you will be asked to provide a valid Task Order number with specific CLIN amounts for cloud services.',
|
||||
)
|
||||
|
||||
dollar_value = IntegerField(
|
||||
@@ -105,17 +111,13 @@ class RequestForm(ValidatedForm):
|
||||
)
|
||||
|
||||
number_user_sessions = IntegerField(
|
||||
description="How many user sessions do you expect on these systems each day?",
|
||||
description="How many user sessions do you expect on these systems each day?"
|
||||
)
|
||||
|
||||
average_daily_traffic = IntegerField(
|
||||
description="What is the average daily traffic you expect the systems under this cloud contract to use?",
|
||||
description="What is the average daily traffic you expect the systems under this cloud contract to use?"
|
||||
)
|
||||
|
||||
start_date = DateField(
|
||||
description="When do you expect to start using the JEDI Cloud (not for billing purposes)?",
|
||||
description="When do you expect to start using the JEDI Cloud (not for billing purposes)?"
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user