mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-28 13:36:30 +02:00
Federal agency changes
This commit is contained in:
parent
9a7a65d958
commit
3290137833
5 changed files with 42 additions and 12 deletions
|
@ -3291,7 +3291,7 @@ class FederalAgencyResource(resources.ModelResource):
|
|||
class FederalAgencyAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||
list_display = ["agency"]
|
||||
search_fields = ["agency"]
|
||||
search_help_text = "Search by agency name."
|
||||
search_help_text = "Search by federal agency."
|
||||
ordering = ["agency"]
|
||||
resource_classes = [FederalAgencyResource]
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Command(BaseCommand, PopulateScriptTemplate):
|
|||
"""For each record, update the initials and is_fceb field if data exists for it"""
|
||||
initials, agency_status = self.federal_agency_dict.get(record.agency)
|
||||
|
||||
record.initials = initials
|
||||
record.acronym = initials
|
||||
if agency_status and isinstance(agency_status, str) and agency_status.strip().upper() == "FCEB":
|
||||
record.is_fceb = True
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 4.2.10 on 2024-09-26 15:09
|
||||
# Generated by Django 4.2.10 on 2024-09-27 20:12
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
@ -12,6 +12,37 @@ class Migration(migrations.Migration):
|
|||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="federalagency",
|
||||
name="initials",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="federalagency",
|
||||
name="acronym",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
help_text="Acronym commonly used to reference the federal agency (Optional)",
|
||||
max_length=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="federalagency",
|
||||
name="federal_type",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[("executive", "Executive"), ("judicial", "Judicial"), ("legislative", "Legislative")],
|
||||
max_length=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="federalagency",
|
||||
name="is_fceb",
|
||||
field=models.BooleanField(
|
||||
blank=True, help_text="Federal Civilian Executive Branch (FCEB)", null=True, verbose_name="FCEB"
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="portfolio",
|
||||
name="federal_agency",
|
|
@ -22,21 +22,20 @@ class FederalAgency(TimeStampedModel):
|
|||
choices=BranchChoices.choices,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Federal agency type (executive, judicial, legislative, etc.)",
|
||||
)
|
||||
|
||||
initials = models.CharField(
|
||||
acronym = models.CharField(
|
||||
max_length=10,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Agency initials",
|
||||
help_text="Acronym commonly used to reference the federal agency (Optional)",
|
||||
)
|
||||
|
||||
is_fceb = models.BooleanField(
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name="FCEB",
|
||||
help_text="Determines if this agency is FCEB",
|
||||
help_text="Federal Civilian Executive Branch (FCEB)",
|
||||
)
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
|
|
@ -1387,18 +1387,18 @@ class TestPopulateFederalAgencyInitialsAndFceb(TestCase):
|
|||
self.agency4.refresh_from_db()
|
||||
|
||||
# Check if FederalAgency objects were updated correctly
|
||||
self.assertEqual(self.agency1.initials, "ABMC")
|
||||
self.assertEqual(self.agency1.acronym, "ABMC")
|
||||
self.assertTrue(self.agency1.is_fceb)
|
||||
|
||||
self.assertEqual(self.agency2.initials, "ACHP")
|
||||
self.assertEqual(self.agency2.acronym, "ACHP")
|
||||
self.assertTrue(self.agency2.is_fceb)
|
||||
|
||||
# We expect that this field doesn't have any data,
|
||||
# as none is specified in the CSV
|
||||
self.assertIsNone(self.agency3.initials)
|
||||
self.assertIsNone(self.agency3.acronym)
|
||||
self.assertIsNone(self.agency3.is_fceb)
|
||||
|
||||
self.assertEqual(self.agency4.initials, "KC")
|
||||
self.assertEqual(self.agency4.acronym, "KC")
|
||||
self.assertFalse(self.agency4.is_fceb)
|
||||
|
||||
@less_console_noise_decorator
|
||||
|
@ -1411,7 +1411,7 @@ class TestPopulateFederalAgencyInitialsAndFceb(TestCase):
|
|||
|
||||
# Verify that the missing agency was not updated
|
||||
missing_agency.refresh_from_db()
|
||||
self.assertIsNone(missing_agency.initials)
|
||||
self.assertIsNone(missing_agency.acronym)
|
||||
self.assertIsNone(missing_agency.is_fceb)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue