Merge branch 'main' into za/1852-user-contact-info-inline

This commit is contained in:
zandercymatics 2024-03-25 08:24:52 -06:00
commit 3b652cda6c
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
36 changed files with 305 additions and 204 deletions

View file

@ -250,7 +250,7 @@ type
docker-compose run owasp docker-compose run owasp
``` ```
# Images, stylesheets, and JavaScript ## Images, stylesheets, and JavaScript
We use the U.S. Web Design System (USWDS) for styling our applications. We use the U.S. Web Design System (USWDS) for styling our applications.
@ -262,7 +262,7 @@ Assets are stored in `registrar/assets` during development and served from `regi
We utilize the [uswds-compile tool](https://designsystem.digital.gov/documentation/getting-started/developers/phase-two-compile/) from USWDS to compile and package USWDS assets. We utilize the [uswds-compile tool](https://designsystem.digital.gov/documentation/getting-started/developers/phase-two-compile/) from USWDS to compile and package USWDS assets.
## Making and viewing style changes ### Making and viewing style changes
When you run `docker-compose up` the `node` service in the container will begin to watch for changes in the `registrar/assets` folder, and will recompile once any changes are made. When you run `docker-compose up` the `node` service in the container will begin to watch for changes in the `registrar/assets` folder, and will recompile once any changes are made.
@ -273,7 +273,11 @@ Within the `registrar/assets` folder, the `_theme` folder contains three files i
You can also compile the **Sass** at any time using `npx gulp compile`. Similarly, you can copy over **other static assets** (images and javascript files), using `npx gulp copyAssets`. You can also compile the **Sass** at any time using `npx gulp compile`. Similarly, you can copy over **other static assets** (images and javascript files), using `npx gulp copyAssets`.
## Upgrading USWDS and other JavaScript packages ### CSS class naming conventions
We use the [CSS Block Element Modifier (BEM)](https://getbem.com/naming/) naming convention for our custom classes. This is in line with how USWDS [approaches](https://designsystem.digital.gov/whats-new/updates/2019/04/08/introducing-uswds-2-0/) their CSS class architecture and helps keep our code cohesive and readable.
### Upgrading USWDS and other JavaScript packages
Version numbers can be manually controlled in `package.json`. Edit that, if desired. Version numbers can be manually controlled in `package.json`. Edit that, if desired.

View file

@ -33,8 +33,8 @@ class AuthenticationFailed(OIDCException):
friendly_message = "This login attempt didn't work." friendly_message = "This login attempt didn't work."
class NoStateDefined(OIDCException): class StateMismatch(AuthenticationFailed):
friendly_message = "The session state is None." friendly_message = "State mismatch. This login attempt didn't work."
class InternalError(OIDCException): class InternalError(OIDCException):

View file

@ -182,10 +182,20 @@ class Client(oic.Client):
if authn_response["state"] != session.get("state", None): if authn_response["state"] != session.get("state", None):
# this most likely means the user's Django session vanished # this most likely means the user's Django session vanished
logger.error("Received state not the same as expected for %s" % state)
if session.get("state", None) is None: if session.get("state", None) is None:
raise o_e.NoStateDefined() logger.error(
raise o_e.AuthenticationFailed(locator=state) f"The OP state {state} does not match the session state. "
f"The session state is None. "
f"authn_response['state'] = {authn_response['state']} "
f"session.get('state', None) = {session.get('state', None)}"
)
else:
logger.error(
f"The OP state {state} does not match the session state. "
f"authn_response['state'] = {authn_response['state']} "
f"session.get('state', None) = {session.get('state', None)}"
)
raise o_e.StateMismatch()
if self.behaviour.get("response_type") == "code": if self.behaviour.get("response_type") == "code":
# need an access token to get user info (and to log the user out later) # need an access token to get user info (and to log the user out later)

View file

@ -4,7 +4,7 @@ from django.http import HttpResponse
from django.test import Client, TestCase, RequestFactory from django.test import Client, TestCase, RequestFactory
from django.urls import reverse from django.urls import reverse
from djangooidc.exceptions import NoStateDefined, InternalError from djangooidc.exceptions import StateMismatch, InternalError
from ..views import login_callback from ..views import login_callback
from .common import less_console_noise from .common import less_console_noise
@ -129,21 +129,35 @@ class ViewsTest(TestCase):
self.assertContains(response, "Hi") self.assertContains(response, "Hi")
def test_login_callback_with_no_session_state(self, mock_client): def test_login_callback_with_no_session_state(self, mock_client):
"""If the local session is None (ie the server restarted while user was logged out), """If the local session does not match the OP session,
we do not throw an exception. Rather, we attempt to login again.""" we do not throw an exception. Rather, we attempt to login again."""
with less_console_noise(): with less_console_noise():
# MOCK # MOCK get_default_acr_value and the callback to raise StateMismatch
# mock the acr_value to some string # error when called
# mock the callback function to raise the NoStateDefined Exception
mock_client.get_default_acr_value.side_effect = self.create_acr mock_client.get_default_acr_value.side_effect = self.create_acr
mock_client.callback.side_effect = NoStateDefined() mock_client.callback.side_effect = StateMismatch()
# TEST # TEST receiving a response from login.gov
# test the login callback
response = self.client.get(reverse("openid_login_callback")) response = self.client.get(reverse("openid_login_callback"))
# ASSERTIONS # ASSERT
# assert that the user is redirected to the start of the login process
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, "/") self.assertEqual(response.url, "/")
# Check that the redirect_attempted flag is set in the session
self.assertTrue(self.client.session.get("redirect_attempted", False))
def test_login_callback_with_no_session_state_attempt_again_only_once(self, mock_client):
"""We only attempt to relogin once. After that, it's the error page for you."""
with less_console_noise():
# MOCK get_default_acr_value, redirect_attempted to True and the callback
# to raise StateMismatch error when called
mock_client.get_default_acr_value.side_effect = self.create_acr
mock_client.callback.side_effect = StateMismatch()
session = self.client.session
session["redirect_attempted"] = True
session.save()
# TEST receiving a response from login.gov
response = self.client.get(reverse("openid_login_callback"))
# ASSERT
self.assertEqual(response.status_code, 401)
def test_login_callback_reads_next(self, mock_client): def test_login_callback_reads_next(self, mock_client):
"""If the next value is set in the session, test that login_callback returns """If the next value is set in the session, test that login_callback returns

View file

@ -101,16 +101,25 @@ def login_callback(request):
if user: if user:
login(request, user) login(request, user)
logger.info("Successfully logged in user %s" % user) logger.info("Successfully logged in user %s" % user)
# Double login bug (1507)? # Clear the flag if the exception is not caught
request.session.pop("redirect_attempted", None)
return redirect(request.session.get("next", "/")) return redirect(request.session.get("next", "/"))
else: else:
raise o_e.BannedUser() raise o_e.BannedUser()
except o_e.NoStateDefined as nsd_err: except o_e.StateMismatch as nsd_err:
# In the event that a user is in the middle of a login when the app is restarted, # Check if the redirect has already been attempted
# their session state will no longer be available, so redirect the user to the if not request.session.get("redirect_attempted", False):
# beginning of login process without raising an error to the user. # Set the flag to indicate that the redirect has been attempted
request.session["redirect_attempted"] = True
# In the event of a state mismatch between OP and session, redirect the user to the
# beginning of login process without raising an error to the user. Attempt once.
logger.warning(f"No State Defined: {nsd_err}") logger.warning(f"No State Defined: {nsd_err}")
return redirect(request.session.get("next", "/")) return redirect(request.session.get("next", "/"))
else:
# Clear the flag if the exception is not caught
request.session.pop("redirect_attempted", None)
return error_page(request, nsd_err)
except Exception as err: except Exception as err:
return error_page(request, err) return error_page(request, err)

View file

@ -830,7 +830,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
# Columns # Columns
list_display = [ list_display = [
"domain", "domain",
"organization_type", "generic_org_type",
"created_at", "created_at",
"submitter", "submitter",
] ]
@ -841,7 +841,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
] ]
# Filters # Filters
list_filter = ["organization_type"] list_filter = ["generic_org_type"]
# Search # Search
search_fields = [ search_fields = [
@ -858,7 +858,7 @@ class DomainInformationAdmin(ListHeaderAdmin):
"Type of organization", "Type of organization",
{ {
"fields": [ "fields": [
"organization_type", "generic_org_type",
"is_election_board", "is_election_board",
"federal_type", "federal_type",
"federal_agency", "federal_agency",
@ -1003,7 +1003,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
list_display = [ list_display = [
"requested_domain", "requested_domain",
"status", "status",
"organization_type", "generic_org_type",
"federal_type", "federal_type",
"federal_agency", "federal_agency",
"organization_name", "organization_name",
@ -1030,7 +1030,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
# Filters # Filters
list_filter = ( list_filter = (
"status", "status",
"organization_type", "generic_org_type",
"federal_type", "federal_type",
ElectionOfficeFilter, ElectionOfficeFilter,
"rejection_reason", "rejection_reason",
@ -1068,7 +1068,7 @@ class DomainRequestAdmin(ListHeaderAdmin):
"Type of organization", "Type of organization",
{ {
"fields": [ "fields": [
"organization_type", "generic_org_type",
"is_election_board", "is_election_board",
"federal_type", "federal_type",
"federal_agency", "federal_agency",
@ -1401,7 +1401,7 @@ class DomainAdmin(ListHeaderAdmin):
# Columns # Columns
list_display = [ list_display = [
"name", "name",
"organization_type", "generic_org_type",
"federal_type", "federal_type",
"federal_agency", "federal_agency",
"organization_name", "organization_name",
@ -1426,10 +1426,10 @@ class DomainAdmin(ListHeaderAdmin):
# in autocomplete_fields for domain # in autocomplete_fields for domain
ordering = ["name"] ordering = ["name"]
def organization_type(self, obj): def generic_org_type(self, obj):
return obj.domain_info.get_organization_type_display() return obj.domain_info.get_generic_org_type_display()
organization_type.admin_order_field = "domain_info__organization_type" # type: ignore generic_org_type.admin_order_field = "domain_info__generic_org_type" # type: ignore
def federal_agency(self, obj): def federal_agency(self, obj):
return obj.domain_info.federal_agency if obj.domain_info else None return obj.domain_info.federal_agency if obj.domain_info else None
@ -1466,7 +1466,7 @@ class DomainAdmin(ListHeaderAdmin):
state_territory.admin_order_field = "domain_info__state_territory" # type: ignore state_territory.admin_order_field = "domain_info__state_territory" # type: ignore
# Filters # Filters
list_filter = ["domain_info__organization_type", "domain_info__federal_type", ElectionOfficeFilter, "state"] list_filter = ["domain_info__generic_org_type", "domain_info__federal_type", ElectionOfficeFilter, "state"]
search_fields = ["name"] search_fields = ["name"]
search_help_text = "Search by domain name." search_help_text = "Search by domain name."

View file

@ -30,7 +30,7 @@ class DomainRequestFixture:
# { # {
# "status": "started", # "status": "started",
# "organization_name": "Example - Just started", # "organization_name": "Example - Just started",
# "organization_type": "federal", # "generic_org_type": "federal",
# "federal_agency": None, # "federal_agency": None,
# "federal_type": None, # "federal_type": None,
# "address_line1": None, # "address_line1": None,
@ -98,7 +98,7 @@ class DomainRequestFixture:
def _set_non_foreign_key_fields(cls, da: DomainRequest, app: dict): def _set_non_foreign_key_fields(cls, da: DomainRequest, app: dict):
"""Helper method used by `load`.""" """Helper method used by `load`."""
da.status = app["status"] if "status" in app else "started" da.status = app["status"] if "status" in app else "started"
da.organization_type = app["organization_type"] if "organization_type" in app else "federal" da.generic_org_type = app["generic_org_type"] if "generic_org_type" in app else "federal"
da.federal_agency = ( da.federal_agency = (
app["federal_agency"] app["federal_agency"]
if "federal_agency" in app if "federal_agency" in app

View file

@ -262,8 +262,8 @@ class AuthorizingOfficialContactForm(ContactForm):
return super().save() return super().save()
# Determine if the domain is federal or tribal # Determine if the domain is federal or tribal
is_federal = self.domainInfo.organization_type == DomainRequest.OrganizationChoices.FEDERAL is_federal = self.domainInfo.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL
is_tribal = self.domainInfo.organization_type == DomainRequest.OrganizationChoices.TRIBAL is_tribal = self.domainInfo.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL
# Get the Contact object from the db for the Authorizing Official # Get the Contact object from the db for the Authorizing Official
db_ao = Contact.objects.get(id=self.instance.id) db_ao = Contact.objects.get(id=self.instance.id)
@ -363,8 +363,8 @@ class DomainOrgNameAddressForm(forms.ModelForm):
self.fields["state_territory"].widget.attrs.pop("maxlength", None) self.fields["state_territory"].widget.attrs.pop("maxlength", None)
self.fields["zipcode"].widget.attrs.pop("maxlength", None) self.fields["zipcode"].widget.attrs.pop("maxlength", None)
self.is_federal = self.instance.organization_type == DomainRequest.OrganizationChoices.FEDERAL self.is_federal = self.instance.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL
self.is_tribal = self.instance.organization_type == DomainRequest.OrganizationChoices.TRIBAL self.is_tribal = self.instance.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL
field_to_disable = None field_to_disable = None
if self.is_federal: if self.is_federal:
@ -384,9 +384,9 @@ class DomainOrgNameAddressForm(forms.ModelForm):
# If they get past this point, we forbid it this way. # If they get past this point, we forbid it this way.
# This could be malicious, so lets reserve information for the backend only. # This could be malicious, so lets reserve information for the backend only.
if self.is_federal and not self._field_unchanged("federal_agency"): if self.is_federal and not self._field_unchanged("federal_agency"):
raise ValueError("federal_agency cannot be modified when the organization_type is federal") raise ValueError("federal_agency cannot be modified when the generic_org_type is federal")
elif self.is_tribal and not self._field_unchanged("organization_name"): elif self.is_tribal and not self._field_unchanged("organization_name"):
raise ValueError("organization_name cannot be modified when the organization_type is tribal") raise ValueError("organization_name cannot be modified when the generic_org_type is tribal")
else: else:
super().save() super().save()

View file

@ -169,7 +169,7 @@ class RegistrarFormSet(forms.BaseFormSet):
class OrganizationTypeForm(RegistrarForm): class OrganizationTypeForm(RegistrarForm):
organization_type = forms.ChoiceField( generic_org_type = forms.ChoiceField(
# use the long names in the domain request form # use the long names in the domain request form
choices=DomainRequest.OrganizationChoicesVerbose.choices, choices=DomainRequest.OrganizationChoicesVerbose.choices,
widget=forms.RadioSelect, widget=forms.RadioSelect,

View file

@ -332,7 +332,7 @@ class Command(BaseCommand):
updated = False updated = False
fields_to_update = [ fields_to_update = [
"organization_type", "generic_org_type",
"federal_type", "federal_type",
"federal_agency", "federal_agency",
"organization_name", "organization_name",
@ -400,7 +400,7 @@ class Command(BaseCommand):
if debug_on: if debug_on:
logger.info(f"Contact created: {contact}") logger.info(f"Contact created: {contact}")
org_type_current = transition_domain.organization_type org_type_current = transition_domain.generic_org_type
match org_type_current: match org_type_current:
case "Federal": case "Federal":
org_type = ("federal", "Federal") org_type = ("federal", "Federal")
@ -431,7 +431,7 @@ class Command(BaseCommand):
} }
if valid_org_type: if valid_org_type:
new_domain_info_data["organization_type"] = org_type[0] new_domain_info_data["generic_org_type"] = org_type[0]
elif debug_on: elif debug_on:
logger.debug(f"No org type found on {domain.name}") logger.debug(f"No org type found on {domain.name}")

View file

@ -200,7 +200,7 @@ class LoadExtraTransitionDomain:
updated_fields = [ updated_fields = [
"organization_name", "organization_name",
"organization_type", "generic_org_type",
"federal_type", "federal_type",
"federal_agency", "federal_agency",
"first_name", "first_name",
@ -412,7 +412,7 @@ class LoadExtraTransitionDomain:
return transition_domain return transition_domain
def parse_domain_type_data(self, domain_name, transition_domain: TransitionDomain) -> TransitionDomain: def parse_domain_type_data(self, domain_name, transition_domain: TransitionDomain) -> TransitionDomain:
"""Grabs organization_type and federal_type from the parsed files """Grabs generic_org_type and federal_type from the parsed files
and associates it with a transition_domain object, then returns that object.""" and associates it with a transition_domain object, then returns that object."""
if not isinstance(transition_domain, TransitionDomain): if not isinstance(transition_domain, TransitionDomain):
raise ValueError("Not a valid object, must be TransitionDomain") raise ValueError("Not a valid object, must be TransitionDomain")
@ -439,7 +439,7 @@ class LoadExtraTransitionDomain:
raise ValueError("Found invalid data on DOMAIN_ADHOC") raise ValueError("Found invalid data on DOMAIN_ADHOC")
# Then, just grab the organization type. # Then, just grab the organization type.
new_organization_type = domain_type[0].strip() new_generic_org_type = domain_type[0].strip()
# Check if this domain_type is active or not. # Check if this domain_type is active or not.
# If not, we don't want to add this. # If not, we don't want to add this.
@ -455,8 +455,8 @@ class LoadExtraTransitionDomain:
# Are we updating data that already exists, # Are we updating data that already exists,
# or are we adding new data in its place? # or are we adding new data in its place?
organization_type_exists = ( generic_org_type_exists = (
transition_domain.organization_type is not None and transition_domain.organization_type.strip() != "" transition_domain.generic_org_type is not None and transition_domain.generic_org_type.strip() != ""
) )
federal_type_exists = ( federal_type_exists = (
transition_domain.federal_type is not None and transition_domain.federal_type.strip() != "" transition_domain.federal_type is not None and transition_domain.federal_type.strip() != ""
@ -467,20 +467,20 @@ class LoadExtraTransitionDomain:
is_federal = domain_type_length == 2 is_federal = domain_type_length == 2
if is_federal: if is_federal:
new_federal_type = domain_type[1].strip() new_federal_type = domain_type[1].strip()
transition_domain.organization_type = new_organization_type transition_domain.generic_org_type = new_generic_org_type
transition_domain.federal_type = new_federal_type transition_domain.federal_type = new_federal_type
else: else:
transition_domain.organization_type = new_organization_type transition_domain.generic_org_type = new_generic_org_type
transition_domain.federal_type = None transition_domain.federal_type = None
# Logs if we either added to this property, # Logs if we either added to this property,
# or modified it. # or modified it.
self._add_or_change_message( self._add_or_change_message(
EnumFilenames.DOMAIN_ADHOC, EnumFilenames.DOMAIN_ADHOC,
"organization_type", "generic_org_type",
transition_domain.organization_type, transition_domain.generic_org_type,
domain_name, domain_name,
organization_type_exists, generic_org_type_exists,
) )
self._add_or_change_message( self._add_or_change_message(

View file

@ -0,0 +1,35 @@
# Generated by Django 4.2.10 on 2024-03-15 18:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("registrar", "0076_alter_domainrequest_current_websites_and_more"),
]
operations = [
migrations.AlterField(
model_name="publiccontact",
name="fax",
field=models.CharField(
blank=True, help_text="Contact's fax number (null ok). Must be in ITU.E164.2005 format.", null=True
),
),
migrations.AlterField(
model_name="publiccontact",
name="org",
field=models.CharField(blank=True, help_text="Contact's organization (null ok)", null=True),
),
migrations.AlterField(
model_name="publiccontact",
name="street2",
field=models.CharField(blank=True, help_text="Contact's street (null ok)", null=True),
),
migrations.AlterField(
model_name="publiccontact",
name="street3",
field=models.CharField(blank=True, help_text="Contact's street (null ok)", null=True),
),
]

View file

@ -0,0 +1,28 @@
# Generated by Django 4.2.10 on 2024-03-20 21:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("registrar", "0077_alter_publiccontact_fax_alter_publiccontact_org_and_more"),
]
operations = [
migrations.RenameField(
model_name="domaininformation",
old_name="organization_type",
new_name="generic_org_type",
),
migrations.RenameField(
model_name="domainrequest",
old_name="organization_type",
new_name="generic_org_type",
),
migrations.RenameField(
model_name="transitiondomain",
old_name="organization_type",
new_name="generic_org_type",
),
]

View file

@ -49,7 +49,7 @@ class DomainInformation(TimeStampedModel):
) )
# ##### data fields from the initial form ##### # ##### data fields from the initial form #####
organization_type = models.CharField( generic_org_type = models.CharField(
max_length=255, max_length=255,
choices=OrganizationChoices.choices, choices=OrganizationChoices.choices,
null=True, null=True,

View file

@ -397,7 +397,7 @@ class DomainRequest(TimeStampedModel):
) )
# ##### data fields from the initial form ##### # ##### data fields from the initial form #####
organization_type = models.CharField( generic_org_type = models.CharField(
max_length=255, max_length=255,
# use the short names in Django admin # use the short names in Django admin
choices=OrganizationChoices.choices, choices=OrganizationChoices.choices,
@ -886,12 +886,12 @@ class DomainRequest(TimeStampedModel):
def show_organization_federal(self) -> bool: def show_organization_federal(self) -> bool:
"""Show this step if the answer to the first question was "federal".""" """Show this step if the answer to the first question was "federal"."""
user_choice = self.organization_type user_choice = self.generic_org_type
return user_choice == DomainRequest.OrganizationChoices.FEDERAL return user_choice == DomainRequest.OrganizationChoices.FEDERAL
def show_tribal_government(self) -> bool: def show_tribal_government(self) -> bool:
"""Show this step if the answer to the first question was "tribal".""" """Show this step if the answer to the first question was "tribal"."""
user_choice = self.organization_type user_choice = self.generic_org_type
return user_choice == DomainRequest.OrganizationChoices.TRIBAL return user_choice == DomainRequest.OrganizationChoices.TRIBAL
def show_organization_election(self) -> bool: def show_organization_election(self) -> bool:
@ -900,7 +900,7 @@ class DomainRequest(TimeStampedModel):
This shows for answers that aren't "Federal" or "Interstate". This shows for answers that aren't "Federal" or "Interstate".
This also doesnt show if user selected "School District" as well (#524) This also doesnt show if user selected "School District" as well (#524)
""" """
user_choice = self.organization_type user_choice = self.generic_org_type
excluded = [ excluded = [
DomainRequest.OrganizationChoices.FEDERAL, DomainRequest.OrganizationChoices.FEDERAL,
DomainRequest.OrganizationChoices.INTERSTATE, DomainRequest.OrganizationChoices.INTERSTATE,
@ -910,7 +910,7 @@ class DomainRequest(TimeStampedModel):
def show_about_your_organization(self) -> bool: def show_about_your_organization(self) -> bool:
"""Show this step if this is a special district or interstate.""" """Show this step if this is a special district or interstate."""
user_choice = self.organization_type user_choice = self.generic_org_type
return user_choice in [ return user_choice in [
DomainRequest.OrganizationChoices.SPECIAL_DISTRICT, DomainRequest.OrganizationChoices.SPECIAL_DISTRICT,
DomainRequest.OrganizationChoices.INTERSTATE, DomainRequest.OrganizationChoices.INTERSTATE,
@ -927,12 +927,12 @@ class DomainRequest(TimeStampedModel):
def is_federal(self) -> Union[bool, None]: def is_federal(self) -> Union[bool, None]:
"""Is this domain request for a federal agency? """Is this domain request for a federal agency?
organization_type can be both null and blank, generic_org_type can be both null and blank,
""" """
if not self.organization_type: if not self.generic_org_type:
# organization_type is either blank or None, can't answer # generic_org_type is either blank or None, can't answer
return None return None
if self.organization_type == DomainRequest.OrganizationChoices.FEDERAL: if self.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL:
return True return True
return False return False

View file

@ -60,10 +60,10 @@ class PublicContact(TimeStampedModel):
) )
name = models.CharField(null=False, help_text="Contact's full name") name = models.CharField(null=False, help_text="Contact's full name")
org = models.CharField(null=True, help_text="Contact's organization (null ok)") org = models.CharField(null=True, blank=True, help_text="Contact's organization (null ok)")
street1 = models.CharField(null=False, help_text="Contact's street") street1 = models.CharField(null=False, help_text="Contact's street")
street2 = models.CharField(null=True, help_text="Contact's street (null ok)") street2 = models.CharField(null=True, blank=True, help_text="Contact's street (null ok)")
street3 = models.CharField(null=True, help_text="Contact's street (null ok)") street3 = models.CharField(null=True, blank=True, help_text="Contact's street (null ok)")
city = models.CharField(null=False, help_text="Contact's city") city = models.CharField(null=False, help_text="Contact's city")
sp = models.CharField(null=False, help_text="Contact's state or province") sp = models.CharField(null=False, help_text="Contact's state or province")
pc = models.CharField(null=False, help_text="Contact's postal code") pc = models.CharField(null=False, help_text="Contact's postal code")
@ -72,6 +72,7 @@ class PublicContact(TimeStampedModel):
voice = models.CharField(null=False, help_text="Contact's phone number. Must be in ITU.E164.2005 format") voice = models.CharField(null=False, help_text="Contact's phone number. Must be in ITU.E164.2005 format")
fax = models.CharField( fax = models.CharField(
null=True, null=True,
blank=True,
help_text="Contact's fax number (null ok). Must be in ITU.E164.2005 format.", help_text="Contact's fax number (null ok). Must be in ITU.E164.2005 format.",
) )
pw = models.CharField(null=False, help_text="Contact's authorization code. 16 characters minimum.") pw = models.CharField(null=False, help_text="Contact's authorization code. 16 characters minimum.")

View file

@ -49,7 +49,7 @@ class TransitionDomain(TimeStampedModel):
verbose_name="Processed", verbose_name="Processed",
help_text="Indicates whether this TransitionDomain was already processed", help_text="Indicates whether this TransitionDomain was already processed",
) )
organization_type = models.CharField( generic_org_type = models.CharField(
max_length=255, max_length=255,
null=True, null=True,
blank=True, blank=True,
@ -147,7 +147,7 @@ class TransitionDomain(TimeStampedModel):
f"username: {self.username}, \n" f"username: {self.username}, \n"
f"status: {self.status}, \n" f"status: {self.status}, \n"
f"email sent: {self.email_sent}, \n" f"email sent: {self.email_sent}, \n"
f"organization type: {self.organization_type}, \n" f"organization type: {self.generic_org_type}, \n"
f"organization_name: {self.organization_name}, \n" f"organization_name: {self.organization_name}, \n"
f"federal_type: {self.federal_type}, \n" f"federal_type: {self.federal_type}, \n"
f"federal_agency: {self.federal_agency}, \n" f"federal_agency: {self.federal_agency}, \n"

View file

@ -12,7 +12,7 @@
<p>Your authorizing official is a person within your organization who can <p>Your authorizing official is a person within your organization who can
authorize domain requests. This person must be in a role of significant, executive responsibility within the organization. Read more about <a class="usa-link" rel="noopener noreferrer" target="_blank" href="{% public_site_url 'domains/eligibility/#you-must-have-approval-from-an-authorizing-official-within-your-organization' %}">who can serve as an authorizing official</a>.</p> authorize domain requests. This person must be in a role of significant, executive responsibility within the organization. Read more about <a class="usa-link" rel="noopener noreferrer" target="_blank" href="{% public_site_url 'domains/eligibility/#you-must-have-approval-from-an-authorizing-official-within-your-organization' %}">who can serve as an authorizing official</a>.</p>
{% if organization_type == "federal" or organization_type == "tribal" %} {% if generic_org_type == "federal" or generic_org_type == "tribal" %}
<p> <p>
The authorizing official for your organization cant be updated here. The authorizing official for your organization cant be updated here.
To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>. To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
@ -25,7 +25,7 @@
<form class="usa-form usa-form--large" method="post" novalidate id="form-container"> <form class="usa-form usa-form--large" method="post" novalidate id="form-container">
{% csrf_token %} {% csrf_token %}
{% if organization_type == "federal" or organization_type == "tribal" %} {% if generic_org_type == "federal" or generic_org_type == "tribal" %}
{# If all fields are disabled, add SR content #} {# If all fields are disabled, add SR content #}
<div class="usa-sr-only" aria-labelledby="id_first_name" id="sr-ao-first-name">{{ form.first_name.value }}</div> <div class="usa-sr-only" aria-labelledby="id_first_name" id="sr-ao-first-name">{{ form.first_name.value }}</div>
<div class="usa-sr-only" aria-labelledby="id_last_name" id="sr-ao-last-name">{{ form.last_name.value }}</div> <div class="usa-sr-only" aria-labelledby="id_last_name" id="sr-ao-last-name">{{ form.last_name.value }}</div>
@ -41,7 +41,7 @@
{% input_with_errors form.email %} {% input_with_errors form.email %}
{% if organization_type != "federal" and organization_type != "tribal" %} {% if generic_org_type != "federal" and generic_org_type != "tribal" %}
<button type="submit" class="usa-button">Save</button> <button type="submit" class="usa-button">Save</button>
{% endif %} {% endif %}
</form> </form>

View file

@ -11,12 +11,12 @@
<p>The name of your organization will be publicly listed as the domain registrant.</p> <p>The name of your organization will be publicly listed as the domain registrant.</p>
{% if domain.domain_info.organization_type == "federal" %} {% if domain.domain_info.generic_org_type == "federal" %}
<p> <p>
The federal agency for your organization cant be updated here. The federal agency for your organization cant be updated here.
To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>. To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
</p> </p>
{% elif domain.domain_info.organization_type == "tribal" %} {% elif domain.domain_info.generic_org_type == "tribal" %}
<p> <p>
Your organization name cant be updated here. Your organization name cant be updated here.
To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>. To suggest an update, email <a href="mailto:help@get.gov" class="usa-link">help@get.gov</a>.
@ -28,7 +28,7 @@
<form class="usa-form usa-form--large" method="post" novalidate id="form-container"> <form class="usa-form usa-form--large" method="post" novalidate id="form-container">
{% csrf_token %} {% csrf_token %}
{% if domain.domain_info.organization_type == 'federal' %} {% if domain.domain_info.generic_org_type == 'federal' %}
{% input_with_errors form.federal_agency %} {% input_with_errors form.federal_agency %}
{% endif %} {% endif %}

View file

@ -14,6 +14,6 @@
{% block form_fields %} {% block form_fields %}
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %} {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors forms.0.organization_type %} {% input_with_errors forms.0.generic_org_type %}
{% endwith %} {% endwith %}
{% endblock %} {% endblock %}

View file

@ -24,8 +24,8 @@
{% if step == Step.ORGANIZATION_TYPE %} {% if step == Step.ORGANIZATION_TYPE %}
{% namespaced_url 'domain-request' step as domain_request_url %} {% namespaced_url 'domain-request' step as domain_request_url %}
{% if domain_request.organization_type is not None %} {% if domain_request.generic_org_type is not None %}
{% with title=form_titles|get_item:step value=domain_request.get_organization_type_display|default:"Incomplete" %} {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete" %}
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %}
{% endwith %} {% endwith %}
{% else %} {% else %}

View file

@ -52,7 +52,7 @@
<div class="grid-col desktop:grid-offset-2 maxw-tablet"> <div class="grid-col desktop:grid-offset-2 maxw-tablet">
<h2 class="text-primary-darker"> Summary of your domain request </h2> <h2 class="text-primary-darker"> Summary of your domain request </h2>
{% with heading_level='h3' %} {% with heading_level='h3' %}
{% with org_type=DomainRequest.get_organization_type_display %} {% with org_type=DomainRequest.get_generic_org_type_display %}
{% include "includes/summary_item.html" with title='Type of organization' value=org_type heading_level=heading_level %} {% include "includes/summary_item.html" with title='Type of organization' value=org_type heading_level=heading_level %}
{% endwith %} {% endwith %}

View file

@ -1,7 +1,7 @@
SUMMARY OF YOUR DOMAIN REQUEST SUMMARY OF YOUR DOMAIN REQUEST
Type of organization: Type of organization:
{{ domain_request.get_organization_type_display }} {{ domain_request.get_generic_org_type_display }}
{% if domain_request.show_organization_federal %} {% if domain_request.show_organization_federal %}
Federal government branch: Federal government branch:
{{ domain_request.get_federal_type_display }} {{ domain_request.get_federal_type_display }}

View file

@ -24,28 +24,28 @@
{% endif %} {% endif %}
{% elif organization_type == 'city' %} {% elif generic_org_type == 'city' %}
<h3>Cities</h3> <h3>Cities</h3>
<p>Domain requests from cities must be authorized by someone in a role of significant, executive responsibility within the city (mayor, council president, city manager, township/village supervisor, select board chairperson, chief, senior technology officer, or equivalent).</p> <p>Domain requests from cities must be authorized by someone in a role of significant, executive responsibility within the city (mayor, council president, city manager, township/village supervisor, select board chairperson, chief, senior technology officer, or equivalent).</p>
{% elif organization_type == 'county' %} {% elif generic_org_type == 'county' %}
<h3>Counties</h3> <h3>Counties</h3>
<p>Domain requests from counties must be authorized by the commission chair or someone in a role of significant, executive responsibility within the county (county judge, county mayor, parish/borough president, senior technology officer, or equivalent). Other county-level offices (county clerk, sheriff, county auditor, comptroller) may qualify, as well, in some instances.</p> <p>Domain requests from counties must be authorized by the commission chair or someone in a role of significant, executive responsibility within the county (county judge, county mayor, parish/borough president, senior technology officer, or equivalent). Other county-level offices (county clerk, sheriff, county auditor, comptroller) may qualify, as well, in some instances.</p>
{% elif organization_type == 'interstate' %} {% elif generic_org_type == 'interstate' %}
<h3>Interstate organizations</h3> <h3>Interstate organizations</h3>
<p>Domain requests from interstate organizations must be authorized by someone in a role of significant, executive responsibility within the organization (president, director, chair, senior technology officer, or equivalent) or one of the states governors or CIOs.</p> <p>Domain requests from interstate organizations must be authorized by someone in a role of significant, executive responsibility within the organization (president, director, chair, senior technology officer, or equivalent) or one of the states governors or CIOs.</p>
{% elif organization_type == 'school_district' %} {% elif generic_org_type == 'school_district' %}
<h3>School districts</h3> <h3>School districts</h3>
<p>Domain requests from school district governments must be authorized by someone in a role of significant, executive responsibility within the district (board chair, superintendent, senior technology officer, or equivalent).</p> <p>Domain requests from school district governments must be authorized by someone in a role of significant, executive responsibility within the district (board chair, superintendent, senior technology officer, or equivalent).</p>
{% elif organization_type == 'special_district' %} {% elif generic_org_type == 'special_district' %}
<h3>Special districts</h3> <h3>Special districts</h3>
<p>Domain requests from special districts must be authorized by someone in a role of significant, executive responsibility within the district (CEO, chair, executive director, senior technology officer, or equivalent). <p>Domain requests from special districts must be authorized by someone in a role of significant, executive responsibility within the district (CEO, chair, executive director, senior technology officer, or equivalent).
</p> </p>
{% elif organization_type == 'state_or_territory' %} {% elif generic_org_type == 'state_or_territory' %}
<h3>U.S. states and territories</h3> <h3>U.S. states and territories</h3>
<h4>States and territories: executive branch</h4> <h4>States and territories: executive branch</h4>
@ -54,7 +54,7 @@
<h4>States and territories: judicial and legislative branches</h4> <h4>States and territories: judicial and legislative branches</h4>
<p>Domain requests from state legislatures and courts must be authorized by an agencys CIO or someone in a role of significant, executive responsibility within the agency.</p> <p>Domain requests from state legislatures and courts must be authorized by an agencys CIO or someone in a role of significant, executive responsibility within the agency.</p>
{% elif organization_type == 'tribal' %} {% elif generic_org_type == 'tribal' %}
<h3>Tribal governments</h3> <h3>Tribal governments</h3>
<p>Domain requests from federally-recognized tribal governments must be authorized by the tribal leader the <a class="usa-link usa-link--external" rel="noopener noreferrer" target="_blank" href="https://www.bia.gov/service/tribal-leaders-directory">Bureau of Indian Affairs</a> recognizes.</p> <p>Domain requests from federally-recognized tribal governments must be authorized by the tribal leader the <a class="usa-link usa-link--external" rel="noopener noreferrer" target="_blank" href="https://www.bia.gov/service/tribal-leaders-directory">Bureau of Indian Affairs</a> recognizes.</p>
<p>Domain requests from state-recognized tribal governments must be authorized by the tribal leader the individual state recognizes.</p> <p>Domain requests from state-recognized tribal governments must be authorized by the tribal leader the individual state recognizes.</p>

View file

@ -26,7 +26,7 @@
</ul> </ul>
{% endif %} {% endif %}
{% elif organization_type == 'interstate' %} {% elif generic_org_type == 'interstate' %}
<ul class="usa-list"> <ul class="usa-list">
<li>EMScompact.gov</li> <li>EMScompact.gov</li>
@ -34,7 +34,7 @@
<li>trpa.gov</li> <li>trpa.gov</li>
</ul> </ul>
{% elif organization_type == 'state_or_territory' %} {% elif generic_org_type == 'state_or_territory' %}
<p>State .gov domains must include the two-letter state abbreviation or clearly spell out the state name.</p> <p>State .gov domains must include the two-letter state abbreviation or clearly spell out the state name.</p>
<p><strong>Examples:</strong></p> <p><strong>Examples:</strong></p>
<ul class="usa-list"> <ul class="usa-list">
@ -44,7 +44,7 @@
<li>Guam.gov</li> <li>Guam.gov</li>
</ul> </ul>
{% elif organization_type == 'tribal' %} {% elif generic_org_type == 'tribal' %}
<p>Tribal domains may include the suffix -nsn, for native sovereign nation.</p> <p>Tribal domains may include the suffix -nsn, for native sovereign nation.</p>
<p><strong>Examples:</strong></p> <p><strong>Examples:</strong></p>
<ul class="usa-list"> <ul class="usa-list">
@ -53,7 +53,7 @@
<li>TulalipTribalCourt-nsn.gov</li> <li>TulalipTribalCourt-nsn.gov</li>
</ul> </ul>
{% elif organization_type == 'county' %} {% elif generic_org_type == 'county' %}
<p>Most county .gov domains must include the two-letter state abbreviation or the full state name. County names that arent shared by any other city, county, parish, town, borough, village or equivalent in the U.S. (at the time a domain is granted) dont have to refer to their state in their domain name. Counties can include “county” in their domain to distinguish it from other places with similar names.</p> <p>Most county .gov domains must include the two-letter state abbreviation or the full state name. County names that arent shared by any other city, county, parish, town, borough, village or equivalent in the U.S. (at the time a domain is granted) dont have to refer to their state in their domain name. Counties can include “county” in their domain to distinguish it from other places with similar names.</p>
<p>We use the <a class="usa-link usa-link--external" rel="noopener noreferrer" target="_blank" href="https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html">Census Bureaus National Places Gazetteer Files</a> to determine if county names are unique.</p> <p>We use the <a class="usa-link usa-link--external" rel="noopener noreferrer" target="_blank" href="https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html">Census Bureaus National Places Gazetteer Files</a> to determine if county names are unique.</p>
@ -65,7 +65,7 @@
<li>MiamiDade.gov</li> <li>MiamiDade.gov</li>
</ul> </ul>
{% elif organization_type == 'city' %} {% elif generic_org_type == 'city' %}
<p>Most city domains must include the two-letter state abbreviation or clearly spell out the state name. Using phrases like “City of” or “Town of” is optional.</p> <p>Most city domains must include the two-letter state abbreviation or clearly spell out the state name. Using phrases like “City of” or “Town of” is optional.</p>
<p>Cities that meet one of the criteria below dont have to refer to their state in their domain name. <p>Cities that meet one of the criteria below dont have to refer to their state in their domain name.
<ul class="usa-list"> <ul class="usa-list">
@ -81,7 +81,7 @@
</ul> </ul>
</p> </p>
{% elif organization_type == 'special_district' %} {% elif generic_org_type == 'special_district' %}
<p>Domain names must represent your organization or institutional name, not solely the services you provide. It also needs to include your two-letter state abbreviation or clearly spell out the state name.</p> <p>Domain names must represent your organization or institutional name, not solely the services you provide. It also needs to include your two-letter state abbreviation or clearly spell out the state name.</p>
<p><strong>Examples:</strong></p> <p><strong>Examples:</strong></p>
<ul class="usa-list"> <ul class="usa-list">
@ -90,7 +90,7 @@
<li>UtahTrust.gov</li> <li>UtahTrust.gov</li>
</ul> </ul>
{% elif organization_type == 'school_district' %} {% elif generic_org_type == 'school_district' %}
<p>Domain names must represent your organization or institutional name.</p> <p>Domain names must represent your organization or institutional name.</p>
<p><strong>Examples:</strong></p> <p><strong>Examples:</strong></p>
<ul class="usa-list"> <ul class="usa-list">

View file

@ -54,9 +54,9 @@ def contains_checkbox(html_list):
@register.filter @register.filter
def get_organization_long_name(organization_type): def get_organization_long_name(generic_org_type):
organization_choices_dict = dict(DomainRequest.OrganizationChoicesVerbose.choices) organization_choices_dict = dict(DomainRequest.OrganizationChoicesVerbose.choices)
long_form_type = organization_choices_dict[organization_type] long_form_type = organization_choices_dict[generic_org_type]
if long_form_type is None: if long_form_type is None:
logger.error("Organization type error, triggered by a template's custom filter") logger.error("Organization type error, triggered by a template's custom filter")
return "Error" return "Error"

View file

@ -373,7 +373,7 @@ class AuditedAdminMockData:
purpose (str - optional): Sets a domains purpose purpose (str - optional): Sets a domains purpose
Returns: Returns:
Dictionary: { Dictionary: {
organization_type: str, generic_org_type: str,
federal_type: str, federal_type: str,
purpose: str, purpose: str,
organization_name: str = "{} organization".format(item_name), organization_name: str = "{} organization".format(item_name),
@ -391,7 +391,7 @@ class AuditedAdminMockData:
""" # noqa """ # noqa
creator = self.dummy_user(item_name, "creator") creator = self.dummy_user(item_name, "creator")
common_args = dict( common_args = dict(
organization_type=org_type, generic_org_type=org_type,
federal_type=federal_type, federal_type=federal_type,
purpose=purpose, purpose=purpose,
organization_name="{} organization".format(item_name), organization_name="{} organization".format(item_name),
@ -577,67 +577,67 @@ class MockDb(TestCase):
self.domain_information_1, _ = DomainInformation.objects.get_or_create( self.domain_information_1, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_1, domain=self.domain_1,
organization_type="federal", generic_org_type="federal",
federal_agency="World War I Centennial Commission", federal_agency="World War I Centennial Commission",
federal_type="executive", federal_type="executive",
is_election_board=True, is_election_board=True,
) )
self.domain_information_2, _ = DomainInformation.objects.get_or_create( self.domain_information_2, _ = DomainInformation.objects.get_or_create(
creator=self.user, domain=self.domain_2, organization_type="interstate", is_election_board=True creator=self.user, domain=self.domain_2, generic_org_type="interstate", is_election_board=True
) )
self.domain_information_3, _ = DomainInformation.objects.get_or_create( self.domain_information_3, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_3, domain=self.domain_3,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=True, is_election_board=True,
) )
self.domain_information_4, _ = DomainInformation.objects.get_or_create( self.domain_information_4, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_4, domain=self.domain_4,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=True, is_election_board=True,
) )
self.domain_information_5, _ = DomainInformation.objects.get_or_create( self.domain_information_5, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_5, domain=self.domain_5,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=False, is_election_board=False,
) )
self.domain_information_6, _ = DomainInformation.objects.get_or_create( self.domain_information_6, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_6, domain=self.domain_6,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=False, is_election_board=False,
) )
self.domain_information_7, _ = DomainInformation.objects.get_or_create( self.domain_information_7, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_7, domain=self.domain_7,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=False, is_election_board=False,
) )
self.domain_information_8, _ = DomainInformation.objects.get_or_create( self.domain_information_8, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_8, domain=self.domain_8,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=False, is_election_board=False,
) )
self.domain_information_9, _ = DomainInformation.objects.get_or_create( self.domain_information_9, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_9, domain=self.domain_9,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=False, is_election_board=False,
) )
self.domain_information_10, _ = DomainInformation.objects.get_or_create( self.domain_information_10, _ = DomainInformation.objects.get_or_create(
creator=self.user, creator=self.user,
domain=self.domain_10, domain=self.domain_10,
organization_type="federal", generic_org_type="federal",
federal_agency="Armed Forces Retirement Home", federal_agency="Armed Forces Retirement Home",
is_election_board=False, is_election_board=False,
) )
@ -792,7 +792,7 @@ def completed_domain_request(
is_staff=True, is_staff=True,
) )
domain_request_kwargs = dict( domain_request_kwargs = dict(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
is_policy_acknowledged=True, is_policy_acknowledged=True,

View file

@ -287,7 +287,7 @@ class TestDomainAdmin(MockEppLib, WebTest):
# for our actual domain_request # for our actual domain_request
self.assertContains(response, "Federal", count=8) self.assertContains(response, "Federal", count=8)
# This may be a bit more robust # This may be a bit more robust
self.assertContains(response, '<td class="field-organization_type">Federal</td>', count=1) self.assertContains(response, '<td class="field-generic_org_type">Federal</td>', count=1)
# Now let's make sure the long description does not exist # Now let's make sure the long description does not exist
self.assertNotContains(response, "Federal: an agency of the U.S. government") self.assertNotContains(response, "Federal: an agency of the U.S. government")
@ -693,7 +693,7 @@ class TestDomainRequestAdmin(MockEppLib):
# for our actual domain request # for our actual domain request
self.assertContains(response, "Federal", count=6) self.assertContains(response, "Federal", count=6)
# This may be a bit more robust # This may be a bit more robust
self.assertContains(response, '<td class="field-organization_type">Federal</td>', count=1) self.assertContains(response, '<td class="field-generic_org_type">Federal</td>', count=1)
# Now let's make sure the long description does not exist # Now let's make sure the long description does not exist
self.assertNotContains(response, "Federal: an agency of the U.S. government") self.assertNotContains(response, "Federal: an agency of the U.S. government")
@ -1447,7 +1447,7 @@ class TestDomainRequestAdmin(MockEppLib):
"rejection_reason", "rejection_reason",
"creator", "creator",
"investigator", "investigator",
"organization_type", "generic_org_type",
"federally_recognized_tribe", "federally_recognized_tribe",
"state_recognized_tribe", "state_recognized_tribe",
"tribe_name", "tribe_name",
@ -1657,7 +1657,7 @@ class TestDomainRequestAdmin(MockEppLib):
readonly_fields = self.admin.get_list_filter(request) readonly_fields = self.admin.get_list_filter(request)
expected_fields = ( expected_fields = (
"status", "status",
"organization_type", "generic_org_type",
"federal_type", "federal_type",
DomainRequestAdmin.ElectionOfficeFilter, DomainRequestAdmin.ElectionOfficeFilter,
"rejection_reason", "rejection_reason",

View file

@ -101,7 +101,7 @@ class TestDomainRequest(TestCase):
domain_request = DomainRequest.objects.create( domain_request = DomainRequest.objects.create(
creator=user, creator=user,
investigator=user, investigator=user,
organization_type=DomainRequest.OrganizationChoices.FEDERAL, generic_org_type=DomainRequest.OrganizationChoices.FEDERAL,
federal_type=DomainRequest.BranchChoices.EXECUTIVE, federal_type=DomainRequest.BranchChoices.EXECUTIVE,
is_election_board=False, is_election_board=False,
organization_name="Test", organization_name="Test",
@ -129,7 +129,7 @@ class TestDomainRequest(TestCase):
domain, _ = Domain.objects.get_or_create(name="igorville.gov") domain, _ = Domain.objects.get_or_create(name="igorville.gov")
information = DomainInformation.objects.create( information = DomainInformation.objects.create(
creator=user, creator=user,
organization_type=DomainInformation.OrganizationChoices.FEDERAL, generic_org_type=DomainInformation.OrganizationChoices.FEDERAL,
federal_type=DomainInformation.BranchChoices.EXECUTIVE, federal_type=DomainInformation.BranchChoices.EXECUTIVE,
is_election_board=False, is_election_board=False,
organization_name="Test", organization_name="Test",

View file

@ -341,9 +341,9 @@ class ExportDataTest(MockDb, MockEppLib):
"State", "State",
"Security contact email", "Security contact email",
] ]
sort_fields = ["domain__name", "federal_agency", "organization_type"] sort_fields = ["domain__name", "federal_agency", "generic_org_type"]
filter_condition = { filter_condition = {
"organization_type__icontains": "federal", "generic_org_type__icontains": "federal",
"domain__state__in": [ "domain__state__in": [
Domain.State.READY, Domain.State.READY,
Domain.State.DNS_NEEDED, Domain.State.DNS_NEEDED,

View file

@ -334,7 +334,7 @@ class TestOrganizationMigration(TestCase):
domain_name="fakewebsite2.gov", domain_name="fakewebsite2.gov",
status="on hold", status="on hold",
email_sent=True, email_sent=True,
organization_type="Federal", generic_org_type="Federal",
organization_name="Fanoodle", organization_name="Fanoodle",
federal_type="Executive", federal_type="Executive",
federal_agency="Department of Commerce", federal_agency="Department of Commerce",
@ -399,7 +399,7 @@ class TestOrganizationMigration(TestCase):
).get() ).get()
expected_domain_information = DomainInformation( expected_domain_information = DomainInformation(
creator=expected_creator, creator=expected_creator,
organization_type="federal", generic_org_type="federal",
federal_agency="Department of Commerce", federal_agency="Department of Commerce",
federal_type="executive", federal_type="executive",
organization_name="Fanoodle", organization_name="Fanoodle",
@ -454,7 +454,7 @@ class TestOrganizationMigration(TestCase):
).get() ).get()
expected_domain_information = DomainInformation( expected_domain_information = DomainInformation(
creator=expected_creator, creator=expected_creator,
organization_type="federal", generic_org_type="federal",
federal_agency="Department of Commerce", federal_agency="Department of Commerce",
federal_type="executive", federal_type="executive",
organization_name="Fanoodle", organization_name="Fanoodle",
@ -794,7 +794,7 @@ class TestMigrations(TestCase):
# parsing right if we get a lot of data. # parsing right if we get a lot of data.
anomaly = anomaly_domain_infos.get() anomaly = anomaly_domain_infos.get()
self.assertEqual(anomaly.organization_name, "Flashdog") self.assertEqual(anomaly.organization_name, "Flashdog")
self.assertEqual(anomaly.organization_type, None) self.assertEqual(anomaly.generic_org_type, None)
self.assertEqual(anomaly.federal_agency, None) self.assertEqual(anomaly.federal_agency, None)
self.assertEqual(anomaly.federal_type, None) self.assertEqual(anomaly.federal_type, None)
@ -809,7 +809,7 @@ class TestMigrations(TestCase):
fakewebsite = fakewebsite_domain_infos.get() fakewebsite = fakewebsite_domain_infos.get()
self.assertEqual(fakewebsite.organization_name, "Fanoodle") self.assertEqual(fakewebsite.organization_name, "Fanoodle")
self.assertEqual(fakewebsite.organization_type, "federal") self.assertEqual(fakewebsite.generic_org_type, "federal")
self.assertEqual(fakewebsite.federal_agency, "Department of Commerce") self.assertEqual(fakewebsite.federal_agency, "Department of Commerce")
self.assertEqual(fakewebsite.federal_type, "executive") self.assertEqual(fakewebsite.federal_type, "executive")

View file

@ -57,7 +57,7 @@ class DomainRequestTests(TestWithUser, WebTest):
self.assertEqual(detail_page.status_code, 302) self.assertEqual(detail_page.status_code, 302)
# You can access the 'Location' header to get the redirect URL # You can access the 'Location' header to get the redirect URL
redirect_url = detail_page.url redirect_url = detail_page.url
self.assertEqual(redirect_url, "/request/organization_type/") self.assertEqual(redirect_url, "/request/generic_org_type/")
def test_domain_request_form_empty_submit(self): def test_domain_request_form_empty_submit(self):
"""Tests empty submit on the first page after the acknowledgement page""" """Tests empty submit on the first page after the acknowledgement page"""
@ -141,13 +141,13 @@ class DomainRequestTests(TestWithUser, WebTest):
# ---- TYPE PAGE ---- # ---- TYPE PAGE ----
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = "federal" type_form["generic_org_type-generic_org_type"] = "federal"
# test next button and validate data # test next button and validate data
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_form.submit() type_result = type_form.submit()
# should see results in db # should see results in db
domain_request = DomainRequest.objects.get() # there's only one domain_request = DomainRequest.objects.get() # there's only one
self.assertEqual(domain_request.organization_type, "federal") self.assertEqual(domain_request.generic_org_type, "federal")
# the post request should return a redirect to the next form in # the post request should return a redirect to the next form in
# the domain request page # the domain request page
self.assertEqual(type_result.status_code, 302) self.assertEqual(type_result.status_code, 302)
@ -522,7 +522,7 @@ class DomainRequestTests(TestWithUser, WebTest):
self.assertNotContains(type_page, self.TITLES["organization_federal"]) self.assertNotContains(type_page, self.TITLES["organization_federal"])
self.assertNotContains(type_page, self.TITLES["organization_election"]) self.assertNotContains(type_page, self.TITLES["organization_election"])
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = "federal" type_form["generic_org_type-generic_org_type"] = "federal"
# set the session ID before .submit() # set the session ID before .submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -577,7 +577,7 @@ class DomainRequestTests(TestWithUser, WebTest):
self.assertNotContains(type_page, self.TITLES["organization_federal"]) self.assertNotContains(type_page, self.TITLES["organization_federal"])
self.assertNotContains(type_page, self.TITLES["organization_election"]) self.assertNotContains(type_page, self.TITLES["organization_election"])
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = "county" type_form["generic_org_type-generic_org_type"] = "county"
# set the session ID before .submit() # set the session ID before .submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -626,7 +626,7 @@ class DomainRequestTests(TestWithUser, WebTest):
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = "federal" type_form["generic_org_type-generic_org_type"] = "federal"
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_form.submit() type_result = type_form.submit()
@ -636,7 +636,7 @@ class DomainRequestTests(TestWithUser, WebTest):
# Now on federal type page, click back to the organization type # Now on federal type page, click back to the organization type
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
new_page = federal_page.click(str(self.TITLES["organization_type"]), index=0) new_page = federal_page.click(str(self.TITLES["generic_org_type"]), index=0)
# Should be a link to the organization_federal page # Should be a link to the organization_federal page
self.assertGreater( self.assertGreater(
@ -663,7 +663,7 @@ class DomainRequestTests(TestWithUser, WebTest):
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.INTERSTATE type_form["generic_org_type-generic_org_type"] = DomainRequest.OrganizationChoices.INTERSTATE
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_form.submit() type_result = type_form.submit()
@ -708,7 +708,7 @@ class DomainRequestTests(TestWithUser, WebTest):
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.SPECIAL_DISTRICT type_form["generic_org_type-generic_org_type"] = DomainRequest.OrganizationChoices.SPECIAL_DISTRICT
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_page.forms[0].submit() type_result = type_page.forms[0].submit()
# follow first redirect # follow first redirect
@ -884,7 +884,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(555) 555 5557", phone="(555) 555 5557",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1018,7 +1018,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5557", phone="(201) 555 5557",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1092,7 +1092,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5557", phone="(201) 555 5557",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1169,7 +1169,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5557", phone="(201) 555 5557",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1245,7 +1245,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5557", phone="(201) 555 5557",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1320,7 +1320,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5556", phone="(201) 555 5556",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1392,7 +1392,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5555", phone="(201) 555 5555",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1458,7 +1458,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5555", phone="(201) 555 5555",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1529,7 +1529,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5555", phone="(201) 555 5555",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1594,7 +1594,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(201) 555 5555", phone="(201) 555 5555",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1667,7 +1667,7 @@ class DomainRequestTests(TestWithUser, WebTest):
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.INTERSTATE type_form["generic_org_type-generic_org_type"] = DomainRequest.OrganizationChoices.INTERSTATE
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_form.submit() type_result = type_form.submit()
# follow first redirect # follow first redirect
@ -1695,7 +1695,7 @@ class DomainRequestTests(TestWithUser, WebTest):
session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = DomainRequest.OrganizationChoices.TRIBAL type_form["generic_org_type-generic_org_type"] = DomainRequest.OrganizationChoices.TRIBAL
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_result = type_form.submit() type_result = type_form.submit()
# the tribal government page comes immediately afterwards # the tribal government page comes immediately afterwards
@ -1726,7 +1726,7 @@ class DomainRequestTests(TestWithUser, WebTest):
# ---- TYPE PAGE ---- # ---- TYPE PAGE ----
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = "federal" type_form["generic_org_type-generic_org_type"] = "federal"
# test next button # test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -1766,9 +1766,9 @@ class DomainRequestTests(TestWithUser, WebTest):
# Go back to organization type page and change type # Go back to organization type page and change type
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
ao_page.click(str(self.TITLES["organization_type"]), index=0) ao_page.click(str(self.TITLES["generic_org_type"]), index=0)
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_form["organization_type-organization_type"] = "city" type_form["generic_org_type-generic_org_type"] = "city"
type_result = type_form.submit() type_result = type_form.submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
election_page = type_result.follow() election_page = type_result.follow()
@ -1797,7 +1797,7 @@ class DomainRequestTests(TestWithUser, WebTest):
# ---- TYPE PAGE ---- # ---- TYPE PAGE ----
type_form = type_page.forms[0] type_form = type_page.forms[0]
type_form["organization_type-organization_type"] = "federal" type_form["generic_org_type-generic_org_type"] = "federal"
# test next button # test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -1866,9 +1866,9 @@ class DomainRequestTests(TestWithUser, WebTest):
# Go back to organization type page and change type # Go back to organization type page and change type
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
dotgov_page.click(str(self.TITLES["organization_type"]), index=0) dotgov_page.click(str(self.TITLES["generic_org_type"]), index=0)
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
type_form["organization_type-organization_type"] = "city" type_form["generic_org_type-generic_org_type"] = "city"
type_result = type_form.submit() type_result = type_form.submit()
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
election_page = type_result.follow() election_page = type_result.follow()
@ -1936,7 +1936,7 @@ class DomainRequestTests(TestWithUser, WebTest):
phone="(555) 555 5557", phone="(555) 555 5557",
) )
domain_request, _ = DomainRequest.objects.get_or_create( domain_request, _ = DomainRequest.objects.get_or_create(
organization_type="federal", generic_org_type="federal",
federal_type="executive", federal_type="executive",
purpose="Purpose of the site", purpose="Purpose of the site",
anything_else="No", anything_else="No",
@ -1965,10 +1965,10 @@ class DomainRequestTests(TestWithUser, WebTest):
# -- the best that can/should be done here is to ensure the correct values # -- the best that can/should be done here is to ensure the correct values
# are being passed to the templating engine # are being passed to the templating engine
url = reverse("domain-request:organization_type") url = reverse("domain-request:generic_org_type")
response = self.client.get(url, follow=True) response = self.client.get(url, follow=True)
self.assertContains(response, "<input>") self.assertContains(response, "<input>")
# choices = response.context['wizard']['form']['organization_type'].subwidgets # choices = response.context['wizard']['form']['generic_org_type'].subwidgets
# radio = [ x for x in choices if x.data["value"] == "federal" ][0] # radio = [ x for x in choices if x.data["value"] == "federal" ][0]
# checked = radio.data["selected"] # checked = radio.data["selected"]
# self.assertTrue(checked) # self.assertTrue(checked)

View file

@ -1051,7 +1051,7 @@ class TestDomainAuthorizingOfficial(TestDomainOverview):
"""Tests that no edit can occur when the underlying domain is federal""" """Tests that no edit can occur when the underlying domain is federal"""
# Set the org type to federal # Set the org type to federal
self.domain_information.organization_type = DomainInformation.OrganizationChoices.FEDERAL self.domain_information.generic_org_type = DomainInformation.OrganizationChoices.FEDERAL
self.domain_information.save() self.domain_information.save()
# Add an AO. We can do this at the model level, just not the form level. # Add an AO. We can do this at the model level, just not the form level.
@ -1107,7 +1107,7 @@ class TestDomainAuthorizingOfficial(TestDomainOverview):
"""Tests that no edit can occur when the underlying domain is tribal""" """Tests that no edit can occur when the underlying domain is tribal"""
# Set the org type to federal # Set the org type to federal
self.domain_information.organization_type = DomainInformation.OrganizationChoices.TRIBAL self.domain_information.generic_org_type = DomainInformation.OrganizationChoices.TRIBAL
self.domain_information.save() self.domain_information.save()
# Add an AO. We can do this at the model level, just not the form level. # Add an AO. We can do this at the model level, just not the form level.
@ -1233,7 +1233,7 @@ class TestDomainOrganization(TestDomainOverview):
# Set the current domain to a tribal organization with a preset value. # Set the current domain to a tribal organization with a preset value.
# Save first, so we can test if saving is unaffected (it should be). # Save first, so we can test if saving is unaffected (it should be).
tribal_org_type = DomainInformation.OrganizationChoices.TRIBAL tribal_org_type = DomainInformation.OrganizationChoices.TRIBAL
self.domain_information.organization_type = tribal_org_type self.domain_information.generic_org_type = tribal_org_type
self.domain_information.save() self.domain_information.save()
try: try:
# Add an org name # Add an org name
@ -1242,7 +1242,7 @@ class TestDomainOrganization(TestDomainOverview):
except ValueError as err: except ValueError as err:
self.fail(f"A ValueError was caught during the test: {err}") self.fail(f"A ValueError was caught during the test: {err}")
self.assertEqual(self.domain_information.organization_type, tribal_org_type) self.assertEqual(self.domain_information.generic_org_type, tribal_org_type)
org_name_page = self.app.get(reverse("domain-org-name-address", kwargs={"pk": self.domain.id})) org_name_page = self.app.get(reverse("domain-org-name-address", kwargs={"pk": self.domain.id}))
@ -1290,7 +1290,7 @@ class TestDomainOrganization(TestDomainOverview):
# Set the current domain to a tribal organization with a preset value. # Set the current domain to a tribal organization with a preset value.
# Save first, so we can test if saving is unaffected (it should be). # Save first, so we can test if saving is unaffected (it should be).
fed_org_type = DomainInformation.OrganizationChoices.FEDERAL fed_org_type = DomainInformation.OrganizationChoices.FEDERAL
self.domain_information.organization_type = fed_org_type self.domain_information.generic_org_type = fed_org_type
self.domain_information.save() self.domain_information.save()
try: try:
self.domain_information.federal_agency = "AMTRAK" self.domain_information.federal_agency = "AMTRAK"
@ -1298,7 +1298,7 @@ class TestDomainOrganization(TestDomainOverview):
except ValueError as err: except ValueError as err:
self.fail(f"A ValueError was caught during the test: {err}") self.fail(f"A ValueError was caught during the test: {err}")
self.assertEqual(self.domain_information.organization_type, fed_org_type) self.assertEqual(self.domain_information.generic_org_type, fed_org_type)
org_name_page = self.app.get(reverse("domain-org-name-address", kwargs={"pk": self.domain.id})) org_name_page = self.app.get(reverse("domain-org-name-address", kwargs={"pk": self.domain.id}))
@ -1346,7 +1346,7 @@ class TestDomainOrganization(TestDomainOverview):
# Set the current domain to a tribal organization with a preset value. # Set the current domain to a tribal organization with a preset value.
# Save first, so we can test if saving is unaffected (it should be). # Save first, so we can test if saving is unaffected (it should be).
federal_org_type = DomainInformation.OrganizationChoices.FEDERAL federal_org_type = DomainInformation.OrganizationChoices.FEDERAL
self.domain_information.organization_type = federal_org_type self.domain_information.generic_org_type = federal_org_type
self.domain_information.save() self.domain_information.save()
old_federal_agency_value = ("AMTRAK", "AMTRAK") old_federal_agency_value = ("AMTRAK", "AMTRAK")
@ -1357,7 +1357,7 @@ class TestDomainOrganization(TestDomainOverview):
except ValueError as err: except ValueError as err:
self.fail(f"A ValueError was caught during the test: {err}") self.fail(f"A ValueError was caught during the test: {err}")
self.assertEqual(self.domain_information.organization_type, federal_org_type) self.assertEqual(self.domain_information.generic_org_type, federal_org_type)
new_value = ("Department of State", "Department of State") new_value = ("Department of State", "Department of State")
self.client.post( self.client.post(

View file

@ -81,9 +81,9 @@ def parse_domain_row(columns, domain_info: DomainInformation, security_emails_di
security_email = "(blank)" security_email = "(blank)"
if domain_info.federal_type: if domain_info.federal_type:
domain_type = f"{domain_info.get_organization_type_display()} - {domain_info.get_federal_type_display()}" domain_type = f"{domain_info.get_generic_org_type_display()} - {domain_info.get_federal_type_display()}"
else: else:
domain_type = domain_info.get_organization_type_display() domain_type = domain_info.get_generic_org_type_display()
# create a dictionary of fields which can be included in output # create a dictionary of fields which can be included in output
FIELDS = { FIELDS = {
@ -217,9 +217,9 @@ def parse_request_row(columns, request: DomainRequest):
requested_domain_name = request.requested_domain.name requested_domain_name = request.requested_domain.name
if request.federal_type: if request.federal_type:
request_type = f"{request.get_organization_type_display()} - {request.get_federal_type_display()}" request_type = f"{request.get_generic_org_type_display()} - {request.get_federal_type_display()}"
else: else:
request_type = request.get_organization_type_display() request_type = request.get_generic_org_type_display()
# create a dictionary of fields which can be included in output # create a dictionary of fields which can be included in output
FIELDS = { FIELDS = {
@ -295,7 +295,7 @@ def export_data_type_to_csv(csv_file):
# Coalesce is used to replace federal_type of None with ZZZZZ # Coalesce is used to replace federal_type of None with ZZZZZ
sort_fields = [ sort_fields = [
"organization_type", "generic_org_type",
Coalesce("federal_type", Value("ZZZZZ")), Coalesce("federal_type", Value("ZZZZZ")),
"federal_agency", "federal_agency",
"domain__name", "domain__name",
@ -328,7 +328,7 @@ def export_data_full_to_csv(csv_file):
] ]
# Coalesce is used to replace federal_type of None with ZZZZZ # Coalesce is used to replace federal_type of None with ZZZZZ
sort_fields = [ sort_fields = [
"organization_type", "generic_org_type",
Coalesce("federal_type", Value("ZZZZZ")), Coalesce("federal_type", Value("ZZZZZ")),
"federal_agency", "federal_agency",
"domain__name", "domain__name",
@ -361,13 +361,13 @@ def export_data_federal_to_csv(csv_file):
] ]
# Coalesce is used to replace federal_type of None with ZZZZZ # Coalesce is used to replace federal_type of None with ZZZZZ
sort_fields = [ sort_fields = [
"organization_type", "generic_org_type",
Coalesce("federal_type", Value("ZZZZZ")), Coalesce("federal_type", Value("ZZZZZ")),
"federal_agency", "federal_agency",
"domain__name", "domain__name",
] ]
filter_condition = { filter_condition = {
"organization_type__icontains": "federal", "generic_org_type__icontains": "federal",
"domain__state__in": [ "domain__state__in": [
Domain.State.READY, Domain.State.READY,
Domain.State.DNS_NEEDED, Domain.State.DNS_NEEDED,
@ -468,23 +468,23 @@ def get_sliced_domains(filter_condition, distinct=False):
# Round trip 2: Get counts for other slices # Round trip 2: Get counts for other slices
if distinct: if distinct:
organization_types_query = ( generic_org_types_query = (
DomainInformation.objects.filter(**filter_condition).values_list("organization_type", flat=True).distinct() DomainInformation.objects.filter(**filter_condition).values_list("generic_org_type", flat=True).distinct()
) )
else: else:
organization_types_query = DomainInformation.objects.filter(**filter_condition).values_list( generic_org_types_query = DomainInformation.objects.filter(**filter_condition).values_list(
"organization_type", flat=True "generic_org_type", flat=True
) )
organization_type_counts = Counter(organization_types_query) generic_org_type_counts = Counter(generic_org_types_query)
federal = organization_type_counts.get(DomainRequest.OrganizationChoices.FEDERAL, 0) federal = generic_org_type_counts.get(DomainRequest.OrganizationChoices.FEDERAL, 0)
interstate = organization_type_counts.get(DomainRequest.OrganizationChoices.INTERSTATE, 0) interstate = generic_org_type_counts.get(DomainRequest.OrganizationChoices.INTERSTATE, 0)
state_or_territory = organization_type_counts.get(DomainRequest.OrganizationChoices.STATE_OR_TERRITORY, 0) state_or_territory = generic_org_type_counts.get(DomainRequest.OrganizationChoices.STATE_OR_TERRITORY, 0)
tribal = organization_type_counts.get(DomainRequest.OrganizationChoices.TRIBAL, 0) tribal = generic_org_type_counts.get(DomainRequest.OrganizationChoices.TRIBAL, 0)
county = organization_type_counts.get(DomainRequest.OrganizationChoices.COUNTY, 0) county = generic_org_type_counts.get(DomainRequest.OrganizationChoices.COUNTY, 0)
city = organization_type_counts.get(DomainRequest.OrganizationChoices.CITY, 0) city = generic_org_type_counts.get(DomainRequest.OrganizationChoices.CITY, 0)
special_district = organization_type_counts.get(DomainRequest.OrganizationChoices.SPECIAL_DISTRICT, 0) special_district = generic_org_type_counts.get(DomainRequest.OrganizationChoices.SPECIAL_DISTRICT, 0)
school_district = organization_type_counts.get(DomainRequest.OrganizationChoices.SCHOOL_DISTRICT, 0) school_district = generic_org_type_counts.get(DomainRequest.OrganizationChoices.SCHOOL_DISTRICT, 0)
# Round trip 3 # Round trip 3
election_board = DomainInformation.objects.filter(is_election_board=True, **filter_condition).distinct().count() election_board = DomainInformation.objects.filter(is_election_board=True, **filter_condition).distinct().count()
@ -511,23 +511,23 @@ def get_sliced_requests(filter_condition, distinct=False):
# Round trip 2: Get counts for other slices # Round trip 2: Get counts for other slices
if distinct: if distinct:
organization_types_query = ( generic_org_types_query = (
DomainRequest.objects.filter(**filter_condition).values_list("organization_type", flat=True).distinct() DomainRequest.objects.filter(**filter_condition).values_list("generic_org_type", flat=True).distinct()
) )
else: else:
organization_types_query = DomainRequest.objects.filter(**filter_condition).values_list( generic_org_types_query = DomainRequest.objects.filter(**filter_condition).values_list(
"organization_type", flat=True "generic_org_type", flat=True
) )
organization_type_counts = Counter(organization_types_query) generic_org_type_counts = Counter(generic_org_types_query)
federal = organization_type_counts.get(DomainRequest.OrganizationChoices.FEDERAL, 0) federal = generic_org_type_counts.get(DomainRequest.OrganizationChoices.FEDERAL, 0)
interstate = organization_type_counts.get(DomainRequest.OrganizationChoices.INTERSTATE, 0) interstate = generic_org_type_counts.get(DomainRequest.OrganizationChoices.INTERSTATE, 0)
state_or_territory = organization_type_counts.get(DomainRequest.OrganizationChoices.STATE_OR_TERRITORY, 0) state_or_territory = generic_org_type_counts.get(DomainRequest.OrganizationChoices.STATE_OR_TERRITORY, 0)
tribal = organization_type_counts.get(DomainRequest.OrganizationChoices.TRIBAL, 0) tribal = generic_org_type_counts.get(DomainRequest.OrganizationChoices.TRIBAL, 0)
county = organization_type_counts.get(DomainRequest.OrganizationChoices.COUNTY, 0) county = generic_org_type_counts.get(DomainRequest.OrganizationChoices.COUNTY, 0)
city = organization_type_counts.get(DomainRequest.OrganizationChoices.CITY, 0) city = generic_org_type_counts.get(DomainRequest.OrganizationChoices.CITY, 0)
special_district = organization_type_counts.get(DomainRequest.OrganizationChoices.SPECIAL_DISTRICT, 0) special_district = generic_org_type_counts.get(DomainRequest.OrganizationChoices.SPECIAL_DISTRICT, 0)
school_district = organization_type_counts.get(DomainRequest.OrganizationChoices.SCHOOL_DISTRICT, 0) school_district = generic_org_type_counts.get(DomainRequest.OrganizationChoices.SCHOOL_DISTRICT, 0)
# Round trip 3 # Round trip 3
election_board = DomainRequest.objects.filter(is_election_board=True, **filter_condition).distinct().count() election_board = DomainRequest.objects.filter(is_election_board=True, **filter_condition).distinct().count()

View file

@ -236,7 +236,7 @@ class DomainAuthorizingOfficialView(DomainFormBaseView):
domain_info = self.get_domain_info_from_domain() domain_info = self.get_domain_info_from_domain()
invalid_fields = [DomainRequest.OrganizationChoices.FEDERAL, DomainRequest.OrganizationChoices.TRIBAL] invalid_fields = [DomainRequest.OrganizationChoices.FEDERAL, DomainRequest.OrganizationChoices.TRIBAL]
is_federal_or_tribal = domain_info and (domain_info.organization_type in invalid_fields) is_federal_or_tribal = domain_info and (domain_info.generic_org_type in invalid_fields)
form_kwargs["disable_fields"] = is_federal_or_tribal form_kwargs["disable_fields"] = is_federal_or_tribal
return form_kwargs return form_kwargs
@ -244,7 +244,7 @@ class DomainAuthorizingOfficialView(DomainFormBaseView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
"""Adds custom context.""" """Adds custom context."""
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["organization_type"] = self.object.domain_info.organization_type context["generic_org_type"] = self.object.domain_info.generic_org_type
return context return context
def get_success_url(self): def get_success_url(self):

View file

@ -33,7 +33,7 @@ class Step(StrEnum):
appear in the order they are defined. (Order matters.) appear in the order they are defined. (Order matters.)
""" """
ORGANIZATION_TYPE = "organization_type" ORGANIZATION_TYPE = "generic_org_type"
TRIBAL_GOVERNMENT = "tribal_government" TRIBAL_GOVERNMENT = "tribal_government"
ORGANIZATION_FEDERAL = "organization_federal" ORGANIZATION_FEDERAL = "organization_federal"
ORGANIZATION_ELECTION = "organization_election" ORGANIZATION_ELECTION = "organization_election"
@ -340,7 +340,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
Queries the DB for a domain request and returns a list of unlocked steps.""" Queries the DB for a domain request and returns a list of unlocked steps."""
history_dict = { history_dict = {
"organization_type": self.domain_request.organization_type is not None, "generic_org_type": self.domain_request.generic_org_type is not None,
"tribal_government": self.domain_request.tribe_name is not None, "tribal_government": self.domain_request.tribe_name is not None,
"organization_federal": self.domain_request.federal_type is not None, "organization_federal": self.domain_request.federal_type is not None,
"organization_election": self.domain_request.is_election_board is not None, "organization_election": self.domain_request.is_election_board is not None,
@ -506,7 +506,7 @@ class AuthorizingOfficial(DomainRequestWizard):
def get_context_data(self): def get_context_data(self):
context = super().get_context_data() context = super().get_context_data()
context["organization_type"] = self.domain_request.organization_type context["generic_org_type"] = self.domain_request.generic_org_type
context["federal_type"] = self.domain_request.federal_type context["federal_type"] = self.domain_request.federal_type
return context return context
@ -522,7 +522,7 @@ class DotgovDomain(DomainRequestWizard):
def get_context_data(self): def get_context_data(self):
context = super().get_context_data() context = super().get_context_data()
context["organization_type"] = self.domain_request.organization_type context["generic_org_type"] = self.domain_request.generic_org_type
context["federal_type"] = self.domain_request.federal_type context["federal_type"] = self.domain_request.federal_type
return context return context