Merge pull request #2046 from cisagov/rh/2909-new-agency-field

ISSUE #2029: Add new model for new federal agency field
This commit is contained in:
Rebecca H 2024-04-19 09:12:25 -07:00 committed by GitHub
commit 564537cf7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 63 additions and 2 deletions

View file

@ -979,7 +979,9 @@ class DomainInformationAdmin(ListHeaderAdmin):
"classes": ["collapse"],
"fields": [
"federal_type",
"federal_agency",
# "updated_federal_agency",
# Above field commented out so it won't display
"federal_agency", # TODO: remove later
"tribe_name",
"federally_recognized_tribe",
"state_recognized_tribe",
@ -1218,7 +1220,9 @@ class DomainRequestAdmin(ListHeaderAdmin):
"classes": ["collapse"],
"fields": [
"federal_type",
"federal_agency",
# "updated_federal_agency",
# Above field commented out so it won't display
"federal_agency", # TODO: remove later
"tribe_name",
"federally_recognized_tribe",
"state_recognized_tribe",

View file

@ -0,0 +1,36 @@
# Generated by Django 4.2.10 on 2024-04-18 22:45
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("registrar", "0085_alter_contact_first_name_alter_contact_last_name_and_more"),
]
operations = [
migrations.AddField(
model_name="domaininformation",
name="updated_federal_agency",
field=models.ForeignKey(
blank=True,
help_text="Associated federal agency",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="registrar.federalagency",
),
),
migrations.AddField(
model_name="domainrequest",
name="updated_federal_agency",
field=models.ForeignKey(
blank=True,
help_text="Associated federal agency",
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="registrar.federalagency",
),
),
]

View file

@ -29,8 +29,18 @@ class DomainInformation(TimeStampedModel):
BranchChoices = DomainRequest.BranchChoices
# TODO for #1975: Delete this after we run the new migration
AGENCY_CHOICES = DomainRequest.AGENCY_CHOICES
updated_federal_agency = models.ForeignKey(
"registrar.FederalAgency",
on_delete=models.PROTECT,
help_text="Associated federal agency",
unique=False,
blank=True,
null=True,
)
# This is the domain request user who created this domain request. The contact
# information that they gave is in the `submitter` field
creator = models.ForeignKey(

View file

@ -449,6 +449,15 @@ class DomainRequest(TimeStampedModel):
blank=True,
)
updated_federal_agency = models.ForeignKey(
"registrar.FederalAgency",
on_delete=models.PROTECT,
help_text="Associated federal agency",
unique=False,
blank=True,
null=True,
)
# This is the domain request user who created this domain request. The contact
# information that they gave is in the `submitter` field
creator = models.ForeignKey(

View file

@ -1862,6 +1862,8 @@ class TestDomainRequestAdmin(MockEppLib):
"updated_at",
"status",
"rejection_reason",
"updated_federal_agency",
# TODO: once approved, we'll have to remove above from test
"creator",
"investigator",
"generic_org_type",