Fix lint errors

This commit is contained in:
Erin 2024-03-19 15:19:44 -07:00
parent 166ccbf5ea
commit 601ded68ac
No known key found for this signature in database
GPG key ID: 1CAD275313C62460
3 changed files with 9 additions and 7 deletions

View file

@ -15,8 +15,7 @@ from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from dateutil.relativedelta import relativedelta # type: ignore
from epplibwrapper.errors import ErrorCode, RegistryError
from registrar.models import Contact, Domain, DomainRequest, DraftDomain, User, Website, FederalAgency
from registrar.utility import csv_export
from registrar.models import Contact, Domain, DomainRequest, DraftDomain, User, Website
from registrar.utility.errors import FSMApplicationError, FSMErrorCodes
from registrar.views.utility.mixins import OrderableFieldsMixin
from django.contrib.admin.views.main import ORDER_VAR
@ -1789,6 +1788,7 @@ class VerifiedByStaffAdmin(ListHeaderAdmin):
obj.requestor = request.user if request.user.is_authenticated else None
super().save_model(request, obj, form, change)
class FederalAgencyAdmin(ListHeaderAdmin):
list_display = ["agency"]
search_fields = ["agency"]

View file

@ -6,10 +6,12 @@ from django.db import migrations, models
from registrar.models import FederalAgency
from typing import Any
# For linting: RunPython expects a function reference.
def create_federal_agencies(apps, schema_editor) -> Any:
FederalAgency.create_federal_agencies(apps, schema_editor)
class Migration(migrations.Migration):
dependencies = [

View file

@ -10,7 +10,7 @@ class FederalAgency(TimeStampedModel):
class Meta:
verbose_name = "Federal agency"
verbose_name_plural = "Federal agencies"
agency = models.CharField(
null=True,
blank=True,
@ -18,12 +18,12 @@ class FederalAgency(TimeStampedModel):
)
def __str__(self) -> str:
return self.agency
return f"{self.agency}"
# TODO: Update parameters to put in
def create_federal_agencies(apps, schema_editor):
"""This method gets run from a data migration."""
# Hard to pass self to these methods as the calls from migrations
# are only expecting apps and schema_editor, so we'll just define
# apps, schema_editor in the local scope instead
@ -213,10 +213,10 @@ class FederalAgency(TimeStampedModel):
"Woodrow Wilson International Center for Scholars",
"World War I Centennial Commission",
]
FederalAgency = apps.get_model("registrar", "FederalAgency")
logger.info("Creating federal agency table.")
try:
for agency in AGENCIES:
federal_agencies_list, _ = FederalAgency.objects.get_or_create(