use defaults

This commit is contained in:
zandercymatics 2024-08-29 11:42:32 -06:00
parent 12eab5c44f
commit 11d662aa3c
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 7 additions and 1 deletions

View file

@ -71,7 +71,10 @@ class Command(BaseCommand):
if federal_agency.so_federal_agency.exists():
portfolio_args["senior_official"] = federal_agency.so_federal_agency.first()
portfolio, created = Portfolio.objects.get_or_create(**portfolio_args)
portfolio, created = Portfolio.objects.get_or_create(
organization_name=portfolio_args.get("organization_name"),
defaults=portfolio_args
)
if created:
message = f"Created portfolio '{portfolio}'"

View file

@ -1428,3 +1428,6 @@ class TestCreateFederalPortfolio(TestCase):
# == create_suborganizations tests == #
# == handle_portfolio_requests tests == #
# == handle_portfolio_domains tests == #
# test for parse_requests
# test for parse_domains
# test for both