From 8e7ffab8b2a34b3812c46fd6a254c1233d40bdd9 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Mon, 6 Jan 2025 14:10:40 -0700 Subject: [PATCH] Exclude approved --- .../management/commands/populate_requested_suborg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/registrar/management/commands/populate_requested_suborg.py b/src/registrar/management/commands/populate_requested_suborg.py index e65ed3f53..2fdb14ac2 100644 --- a/src/registrar/management/commands/populate_requested_suborg.py +++ b/src/registrar/management/commands/populate_requested_suborg.py @@ -18,8 +18,12 @@ class Command(BaseCommand, PopulateScriptTemplate): self.mass_update_records(DomainRequest, filter_conditions, fields_to_update) def custom_filter(self, records): - """Exclude domain requests that have the same org name as the portfolio""" - return records.exclude(organization_name__iexact=F("portfolio__organization_name")) + """Exclude domain requests that have the same org name as the portfolio. + Also excludes approved.""" + return records.exclude( + organization_name__iexact=F("portfolio__organization_name"), + status=DomainRequest.DomainRequestStatus.APPROVED, + ) def update_record(self, record: DomainRequest): """Adds data to requested_suborganization, suborganization_city, and suborganization_state_territory."""