diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py index d84ceeb15..5eea13ed8 100644 --- a/src/registrar/forms/domain_request_wizard.py +++ b/src/registrar/forms/domain_request_wizard.py @@ -80,17 +80,17 @@ class RequestingEntityForm(RegistrarForm): return self.cleaned_data.get("sub_organization") def clean_requested_suborganization(self): - name = self.cleaned_data.get('requested_suborganization') - if name and Suborganization.objects.filter( - name__iexact=name, - portfolio=self.domain_request.portfolio, - name__isnull=False, - portfolio__isnull=False - ).exists(): + name = self.cleaned_data.get("requested_suborganization") + if ( + name + and Suborganization.objects.filter( + name__iexact=name, portfolio=self.domain_request.portfolio, name__isnull=False, portfolio__isnull=False + ).exists() + ): raise ValidationError( "This suborganization already exists. " "Choose a new name, or select it directly if you would like to use it." - ) + ) return name def full_clean(self): diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py index 381d28703..f4e2a35a1 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_request.py @@ -679,9 +679,9 @@ class DomainRequest(TimeStampedModel): 2. Partial suborganization data: Enforces a all-or-nothing rule for city/state/name fields when portfolio exists without selected suborganization - Add new domain request validation rules here to ensure they're + Add new domain request validation rules here to ensure they're enforced during both model save and form submission. - Not presently used on the domain request wizard, though. + Not presently used on the domain request wizard, though. """ super().clean() # Validation logic for a suborganization request @@ -717,10 +717,7 @@ class DomainRequest(TimeStampedModel): if not value } # Adds a validation error to each missing field - raise ValidationError({ - k: ValidationError(v, code='required') - for k, v in errors_dict.items() - }) + raise ValidationError({k: ValidationError(v, code="required") for k, v in errors_dict.items()}) def save(self, *args, **kwargs): """Save override for custom properties""" diff --git a/src/registrar/tests/test_reports.py b/src/registrar/tests/test_reports.py index 995782eea..64cfa95b0 100644 --- a/src/registrar/tests/test_reports.py +++ b/src/registrar/tests/test_reports.py @@ -869,6 +869,7 @@ class MemberExportTest(MockDbForIndividualTests, MockEppLib): csv_file.seek(0) # Read the content into a variable csv_content = csv_file.read() + self.maxDiff = None expected_content = ( # Header "Email,Organization admin,Invited by,Joined date,Last active,Domain requests," diff --git a/src/registrar/utility/csv_export.py b/src/registrar/utility/csv_export.py index 66809777b..f05f14d99 100644 --- a/src/registrar/utility/csv_export.py +++ b/src/registrar/utility/csv_export.py @@ -417,7 +417,7 @@ class MemberExport(BaseExport): # Adding a order_by increases output predictability. # Doesn't matter as much for normal use, but makes tests easier. # We should also just be ordering by default anyway. - members = permissions.union(invitations).order_by("email_display") + members = permissions.union(invitations).order_by("email_display", "member_display", "first_name", "last_name") return convert_queryset_to_dict(members, is_model=False) @classmethod