mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-13 16:04:49 +02:00
Initial
This commit is contained in:
parent
cfe177612a
commit
b61e58bcdc
4 changed files with 158 additions and 6 deletions
|
@ -377,11 +377,19 @@ class Command(BaseCommand):
|
||||||
org_choices,
|
org_choices,
|
||||||
debug_on,
|
debug_on,
|
||||||
) -> DomainInformation:
|
) -> DomainInformation:
|
||||||
org_type_current = transition_domain.organization_type
|
org_type = ("", "")
|
||||||
fed_type = transition_domain.federal_type
|
fed_type = transition_domain.federal_type
|
||||||
fed_agency = transition_domain.federal_agency
|
fed_agency = transition_domain.federal_agency
|
||||||
|
|
||||||
org_type = ("", "")
|
# = AO Information = #
|
||||||
|
first_name = transition_domain.first_name
|
||||||
|
middle_name = transition_domain.middle_name
|
||||||
|
last_name = transition_domain.last_name
|
||||||
|
email = transition_domain.email
|
||||||
|
phone = transition_domain.phone
|
||||||
|
|
||||||
|
|
||||||
|
org_type_current = transition_domain.organization_type
|
||||||
match org_type_current:
|
match org_type_current:
|
||||||
case "Federal":
|
case "Federal":
|
||||||
org_type = ("federal", "Federal")
|
org_type = ("federal", "Federal")
|
||||||
|
@ -408,6 +416,7 @@ class Command(BaseCommand):
|
||||||
"domain": domain,
|
"domain": domain,
|
||||||
"organization_name": transition_domain.organization_name,
|
"organization_name": transition_domain.organization_name,
|
||||||
"creator": default_creator,
|
"creator": default_creator,
|
||||||
|
"authorizing_official":
|
||||||
}
|
}
|
||||||
|
|
||||||
if valid_org_type:
|
if valid_org_type:
|
||||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from typing import Dict
|
from typing import Dict, List
|
||||||
|
|
||||||
from registrar.models.transition_domain import TransitionDomain
|
from registrar.models.transition_domain import TransitionDomain
|
||||||
|
|
||||||
|
@ -175,12 +175,17 @@ class LoadExtraTransitionDomain:
|
||||||
domain_name, transition_domain
|
domain_name, transition_domain
|
||||||
)
|
)
|
||||||
|
|
||||||
# STEP 3: Parse agency data
|
# STEP 3: Parse authority data
|
||||||
|
updated_transition_domain = self.parse_authority_data(
|
||||||
|
domain_name, transition_domain
|
||||||
|
)
|
||||||
|
|
||||||
|
# STEP 4: Parse agency data
|
||||||
updated_transition_domain = self.parse_agency_data(
|
updated_transition_domain = self.parse_agency_data(
|
||||||
domain_name, transition_domain
|
domain_name, transition_domain
|
||||||
)
|
)
|
||||||
|
|
||||||
# STEP 4: Parse creation and expiration data
|
# STEP 5: Parse creation and expiration data
|
||||||
updated_transition_domain = self.parse_creation_expiration_data(
|
updated_transition_domain = self.parse_creation_expiration_data(
|
||||||
domain_name, transition_domain
|
domain_name, transition_domain
|
||||||
)
|
)
|
||||||
|
@ -299,6 +304,60 @@ class LoadExtraTransitionDomain:
|
||||||
|
|
||||||
return transition_domain
|
return transition_domain
|
||||||
|
|
||||||
|
def log_add_or_changed_values(self, file_type, values_to_check, domain_name):
|
||||||
|
for field_name, value in values_to_check:
|
||||||
|
str_exists = (
|
||||||
|
value is not None
|
||||||
|
and value.strip() != ""
|
||||||
|
)
|
||||||
|
# Logs if we either added to this property,
|
||||||
|
# or modified it.
|
||||||
|
self._add_or_change_message(
|
||||||
|
file_type,
|
||||||
|
field_name,
|
||||||
|
value,
|
||||||
|
domain_name,
|
||||||
|
str_exists,
|
||||||
|
)
|
||||||
|
|
||||||
|
def parse_authority_data(self, domain_name, transition_domain) -> TransitionDomain:
|
||||||
|
"""Grabs authorizing_offical data from the parsed files and associates it
|
||||||
|
with a transition_domain object, then returns that object."""
|
||||||
|
if not isinstance(transition_domain, TransitionDomain):
|
||||||
|
raise ValueError("Not a valid object, must be TransitionDomain")
|
||||||
|
|
||||||
|
info = self.get_authority_info(domain_name)
|
||||||
|
if info is None:
|
||||||
|
self.parse_logs.create_log_item(
|
||||||
|
EnumFilenames.AGENCY_ADHOC,
|
||||||
|
LogCode.ERROR,
|
||||||
|
f"Could not add authorizing_official on {domain_name}, no data exists.",
|
||||||
|
domain_name,
|
||||||
|
not self.debug,
|
||||||
|
)
|
||||||
|
return transition_domain
|
||||||
|
|
||||||
|
transition_domain.first_name = info.firstname
|
||||||
|
transition_domain.middle_name = info.middlename
|
||||||
|
transition_domain.last_name = info.lastname
|
||||||
|
transition_domain.email = info.email
|
||||||
|
transition_domain.phone = info.phonenumber
|
||||||
|
|
||||||
|
changed_fields = [
|
||||||
|
("first_name", transition_domain.first_name),
|
||||||
|
("middle_name", transition_domain.middle_name),
|
||||||
|
("last_name", transition_domain.last_name),
|
||||||
|
("email", transition_domain.email),
|
||||||
|
("phone", transition_domain.phone),
|
||||||
|
]
|
||||||
|
self.log_add_or_changed_values(
|
||||||
|
EnumFilenames.AUTHORITY_ADHOC,
|
||||||
|
changed_fields,
|
||||||
|
domain_name
|
||||||
|
)
|
||||||
|
|
||||||
|
return transition_domain
|
||||||
|
|
||||||
def parse_agency_data(self, domain_name, transition_domain) -> TransitionDomain:
|
def parse_agency_data(self, domain_name, transition_domain) -> TransitionDomain:
|
||||||
"""Grabs federal_agency from the parsed files and associates it
|
"""Grabs federal_agency from the parsed files and associates it
|
||||||
with a transition_domain object, then returns that object."""
|
with a transition_domain object, then returns that object."""
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Generated by Django 4.2.7 on 2023-11-09 19:58
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("registrar", "0045_transitiondomain_federal_agency_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transitiondomain",
|
||||||
|
name="email",
|
||||||
|
field=models.TextField(blank=True, help_text="Email", null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transitiondomain",
|
||||||
|
name="first_name",
|
||||||
|
field=models.TextField(
|
||||||
|
blank=True,
|
||||||
|
db_index=True,
|
||||||
|
help_text="First name",
|
||||||
|
null=True,
|
||||||
|
verbose_name="first name / given name",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transitiondomain",
|
||||||
|
name="last_name",
|
||||||
|
field=models.TextField(blank=True, help_text="Last name", null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transitiondomain",
|
||||||
|
name="middle_name",
|
||||||
|
field=models.TextField(blank=True, help_text="Middle name", null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transitiondomain",
|
||||||
|
name="phone",
|
||||||
|
field=models.TextField(blank=True, help_text="Phone", null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transitiondomain",
|
||||||
|
name="title",
|
||||||
|
field=models.TextField(blank=True, help_text="Title", null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,7 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from .utility.time_stamped_model import TimeStampedModel
|
from .utility.time_stamped_model import TimeStampedModel
|
||||||
|
|
||||||
|
|
||||||
class StatusChoices(models.TextChoices):
|
class StatusChoices(models.TextChoices):
|
||||||
READY = "ready", "Ready"
|
READY = "ready", "Ready"
|
||||||
ON_HOLD = "on hold", "On Hold"
|
ON_HOLD = "on hold", "On Hold"
|
||||||
|
@ -77,6 +76,38 @@ class TransitionDomain(TimeStampedModel):
|
||||||
"Duplication of registry's expiration " "date saved for ease of reporting"
|
"Duplication of registry's expiration " "date saved for ease of reporting"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
first_name = models.TextField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text="First name",
|
||||||
|
verbose_name="first name / given name",
|
||||||
|
db_index=True,
|
||||||
|
)
|
||||||
|
middle_name = models.TextField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text="Middle name",
|
||||||
|
)
|
||||||
|
last_name = models.TextField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text="Last name",
|
||||||
|
)
|
||||||
|
title = models.TextField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text="Title",
|
||||||
|
)
|
||||||
|
email = models.TextField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text="Email",
|
||||||
|
)
|
||||||
|
phone = models.TextField(
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
help_text="Phone",
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.username}, {self.domain_name}"
|
return f"{self.username}, {self.domain_name}"
|
||||||
|
@ -95,4 +126,9 @@ class TransitionDomain(TimeStampedModel):
|
||||||
f"federal_agency: {self.federal_agency}, \n"
|
f"federal_agency: {self.federal_agency}, \n"
|
||||||
f"epp_creation_date: {self.epp_creation_date}, \n"
|
f"epp_creation_date: {self.epp_creation_date}, \n"
|
||||||
f"epp_expiration_date: {self.epp_expiration_date}, \n"
|
f"epp_expiration_date: {self.epp_expiration_date}, \n"
|
||||||
|
f"first_name: {self.first_name}, \n"
|
||||||
|
f"middle_name: {self.middle_name}, \n"
|
||||||
|
f"last_name: {self.last_name}, \n"
|
||||||
|
f"email: {self.email}, \n"
|
||||||
|
f"phone: {self.phone}, \n"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue