Add some comments

This commit is contained in:
zandercymatics 2024-10-31 10:05:28 -06:00
parent f0ba59611e
commit 510938430b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 10 additions and 2 deletions

View file

@ -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".
@ -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):

View file

@ -1126,7 +1126,8 @@ class DomainRequest(TimeStampedModel):
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:
@ -1136,6 +1137,7 @@ class DomainRequest(TimeStampedModel):
"""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
@ -1148,6 +1150,7 @@ class DomainRequest(TimeStampedModel):
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.
@ -1167,7 +1170,7 @@ class DomainRequest(TimeStampedModel):
# 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: