diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 70b06abb6..9abb909d2 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -2490,12 +2490,11 @@ class PortfolioAdmin(ListHeaderAdmin): is_federal = obj.organization_type == DomainRequest.OrganizationChoices.FEDERAL if is_federal: obj.organization_name = obj.organization_type - #NOTE: What is meant by "federal agency text name?" + # NOTE: What is meant by "federal agency text name?" super().save_model(request, obj, form, change) - class FederalAgencyAdmin(ListHeaderAdmin): list_display = ["agency"] search_fields = ["agency"] diff --git a/src/registrar/models/__init__.py b/src/registrar/models/__init__.py index 401b8012d..b2cffaf32 100644 --- a/src/registrar/models/__init__.py +++ b/src/registrar/models/__init__.py @@ -37,7 +37,7 @@ __all__ = [ "TransitionDomain", "VerifiedByStaff", "WaffleFlag", - "Portfolio" + "Portfolio", ] auditlog.register(Contact) diff --git a/src/registrar/models/domain_information.py b/src/registrar/models/domain_information.py index c76c6fe3e..c058ab209 100644 --- a/src/registrar/models/domain_information.py +++ b/src/registrar/models/domain_information.py @@ -57,7 +57,6 @@ class DomainInformation(TimeStampedModel): help_text="Person who submitted the domain request", ) - # portfolio portfolio = models.OneToOneField( "registrar.Portfolio", @@ -66,7 +65,7 @@ class DomainInformation(TimeStampedModel): blank=True, related_name="DomainRequest_portfolio", help_text="Portfolio associated with this domain", - ) + ) domain_request = models.OneToOneField( "registrar.DomainRequest", diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py index 75fe0dc0b..3e616f202 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_request.py @@ -307,7 +307,7 @@ class DomainRequest(TimeStampedModel): blank=True, related_name="DomainInformation_portfolio", help_text="Portfolio associated with this domain", - ) + ) # This is the domain request user who created this domain request. The contact # information that they gave is in the `submitter` field diff --git a/src/registrar/models/portfolio.py b/src/registrar/models/portfolio.py index 43605b27d..ca5365177 100644 --- a/src/registrar/models/portfolio.py +++ b/src/registrar/models/portfolio.py @@ -1,47 +1,44 @@ from django.db import models -from django_fsm import FSMField # type: ignore from registrar.models.domain_request import DomainRequest from registrar.models.federal_agency import FederalAgency from .utility.time_stamped_model import TimeStampedModel + def get_default_federal_agency(): """returns non-federal agency""" return FederalAgency.objects.filter(agency="Non-Federal Agency").first() + class Portfolio(TimeStampedModel): """ Portfolio is used for organizing domains/domain-requests into manageable groups. """ - + # use the short names in Django admin OrganizationChoices = DomainRequest.OrganizationChoices StateTerritoryChoices = DomainRequest.StateTerritoryChoices - # creator- user foreign key- stores who created this model should get the user who is adding + # creator- user foreign key- stores who created this model should get the user who is adding # it via django admin if there is a user (aka not done via commandline/ manual means)""" - creator = models.ForeignKey( - "registrar.User", - on_delete=models.PROTECT, - help_text="Associated user", - unique=False - ) + creator = models.ForeignKey("registrar.User", on_delete=models.PROTECT, help_text="Associated user", unique=False) # notes- text field (copy what is done on requests/domains) notes = models.TextField( null=True, blank=True, ) - - # federal agency - FK to fed agency table (Not nullable, should default to the Non-federal agency value in the fed agency table) + + # federal agency - FK to fed agency table (Not nullable, should default + # to the Non-federal agency value in the fed agency table) federal_agency = models.ForeignKey( "registrar.FederalAgency", on_delete=models.PROTECT, help_text="Associated federal agency", unique=False, - default=get_default_federal_agency + default=get_default_federal_agency, ) # organization type- should match organization types allowed on domain info @@ -109,4 +106,4 @@ class Portfolio(TimeStampedModel): blank=True, verbose_name="security contact e-mail", max_length=320, - ) \ No newline at end of file + )