mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
Updates to Cisa Rep fields in Additional Details. Refactored Cisa Rep to utilize ContactsModel
This commit is contained in:
parent
cfce03ac8d
commit
a789b34bc0
5 changed files with 126 additions and 25 deletions
|
@ -457,11 +457,14 @@ class DomainRequest(TimeStampedModel):
|
|||
help_text="Determines if the user has a anything_else or not",
|
||||
)
|
||||
|
||||
cisa_representative_email = models.EmailField(
|
||||
|
||||
cisa_representative = models.ForeignKey(
|
||||
"registrar.Contact",
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name="CISA regional representative",
|
||||
max_length=320,
|
||||
related_name="cisa_representative_domain_requests",
|
||||
on_delete=models.PROTECT,
|
||||
help_text='Cisa Representative listed under "additional information" in the request form',
|
||||
)
|
||||
|
||||
# This is a drop-in replacement for an has_cisa_representative() function.
|
||||
|
@ -534,15 +537,16 @@ class DomainRequest(TimeStampedModel):
|
|||
We handle that here for def save().
|
||||
"""
|
||||
|
||||
cisa_rep_is_not_none = self.cisa_representative is not None
|
||||
logger.debug("CISA REPRESENTATIVE IS %s" % cisa_rep_is_not_none)
|
||||
|
||||
# This ensures that if we have prefilled data, the form is prepopulated
|
||||
if self.cisa_representative_email is not None:
|
||||
self.has_cisa_representative = self.cisa_representative_email != ""
|
||||
if cisa_rep_is_not_none:
|
||||
self.has_cisa_representative = True
|
||||
|
||||
# This check is required to ensure that the form doesn't start out checked
|
||||
if self.has_cisa_representative is not None:
|
||||
self.has_cisa_representative = (
|
||||
self.cisa_representative_email != "" and self.cisa_representative_email is not None
|
||||
)
|
||||
self.has_cisa_representative = cisa_rep_is_not_none
|
||||
|
||||
# This ensures that if we have prefilled data, the form is prepopulated
|
||||
if self.anything_else is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue