Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zandercymatics committed Oct 31, 2024
1 parent f0ba596 commit 5109384
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/registrar/forms/domain_request_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class RequestingEntityForm(RegistrarForm):
All of these fields are not required by default, but as we use javascript to conditionally show
and hide some of these, they then become required in certain circumstances."""

# IMPORTANT: This is tied to DomainRequest.is_requesting_new_suborganization().
# This is due to the from_database method on DomainRequestWizard.
# Add a hidden field to store if the user is requesting a new suborganization.
# This hidden boolean is used for our javascript to communicate to us and to it.
# If true, the suborganization form will auto select a js value "Other".
Expand Down Expand Up @@ -134,6 +136,9 @@ class RequestingEntityYesNoForm(BaseYesNoForm):

# This first option will change dynamically
form_choices = ((False, "Current Organization"), (True, "A suborganization. (choose from list)"))

# IMPORTANT: This is tied to DomainRequest.is_requesting_new_suborganization().
# This is due to the from_database method on DomainRequestWizard.
field_name = "requesting_entity_is_suborganization"

def __init__(self, *args, **kwargs):
Expand Down
7 changes: 5 additions & 2 deletions src/registrar/models/domain_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,8 @@ def reject_with_prejudice(self):
self.creator.restrict_user()

def requesting_entity_is_portfolio(self) -> bool:
"""Determines if this record is requesting that a portfolio be their organization."""
"""Determines if this record is requesting that a portfolio be their organization.
Used for the RequestingEntity page."""
if self.portfolio and self.organization_name == self.portfolio.organization_name:
return True
else:
Expand All @@ -1136,6 +1137,7 @@ def requesting_entity_is_suborganization(self) -> bool:
"""Used to determine if this domain request is also requesting that it be tied to a suborganization.
Checks if this record has a suborganization or not by checking if a suborganization exists,
and if it doesn't, determining if properties like requested_suborganization exist.
Used for the RequestingEntity page.
"""
if self.portfolio and (self.sub_organization or self.is_requesting_new_suborganization()):
return True
Expand All @@ -1148,6 +1150,7 @@ def is_requesting_new_suborganization(self) -> bool:
This only occurs when no suborganization is selected, but they've filled out
the requested_suborganization, suborganization_city, and suborganization_state_territory fields.
Used for the RequestingEntity page.
"""

# If a suborganization already exists, it can't possibly be a new one.
Expand All @@ -1167,7 +1170,7 @@ def is_requesting_new_suborganization(self) -> bool:
# These methods control the conditions in which we should unlock certain domain wizard steps.

def unlock_requesting_entity(self) -> bool:
"""Unlocks the requesting entity step"""
"""Unlocks the requesting entity step. Used for the RequestingEntity page."""
if self.requesting_entity_is_suborganization() or self.requesting_entity_is_portfolio():
return True
else:
Expand Down

0 comments on commit 5109384

Please sign in to comment.