mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
Fixed form state check
This commit is contained in:
parent
377cb30818
commit
c5b841f6fb
2 changed files with 5 additions and 4 deletions
|
@ -685,9 +685,9 @@ class CisaRepresentativeForm(BaseDeletableRegistrarForm):
|
||||||
email = forms.EmailField(
|
email = forms.EmailField(
|
||||||
label="Email",
|
label="Email",
|
||||||
max_length=None,
|
max_length=None,
|
||||||
|
required=False,
|
||||||
error_messages={
|
error_messages={
|
||||||
"invalid": ("Enter your email address in the required format, like name@example.com."),
|
"invalid": ("Enter your email address in the required format, like name@example.com."),
|
||||||
"required": ("Enter the email address of your CISA regional representative."),
|
|
||||||
},
|
},
|
||||||
validators=[
|
validators=[
|
||||||
MaxLengthValidator(
|
MaxLengthValidator(
|
||||||
|
|
|
@ -538,15 +538,16 @@ class DomainRequest(TimeStampedModel):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cisa_rep_is_not_none = self.cisa_representative is not None
|
cisa_rep_is_not_none = self.cisa_representative is not None
|
||||||
logger.debug("CISA REPRESENTATIVE IS %s" % cisa_rep_is_not_none)
|
cisa_first_name = None
|
||||||
|
|
||||||
# This ensures that if we have prefilled data, the form is prepopulated
|
# This ensures that if we have prefilled data, the form is prepopulated
|
||||||
if cisa_rep_is_not_none:
|
if cisa_rep_is_not_none:
|
||||||
self.has_cisa_representative = True
|
cisa_first_name = self.cisa_representative.first_name
|
||||||
|
self.has_cisa_representative = cisa_first_name is not None and cisa_first_name != ""
|
||||||
|
|
||||||
# This check is required to ensure that the form doesn't start out checked
|
# This check is required to ensure that the form doesn't start out checked
|
||||||
if self.has_cisa_representative is not None:
|
if self.has_cisa_representative is not None:
|
||||||
self.has_cisa_representative = cisa_rep_is_not_none
|
self.has_cisa_representative = cisa_first_name is not None and cisa_first_name != ""
|
||||||
|
|
||||||
# This ensures that if we have prefilled data, the form is prepopulated
|
# This ensures that if we have prefilled data, the form is prepopulated
|
||||||
if self.anything_else is not None:
|
if self.anything_else is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue