Update domain_request.py

This commit is contained in:
zandercymatics 2024-12-20 10:28:10 -07:00
parent 9cb3ecebf4
commit 3d6d9b0d2f
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -673,6 +673,16 @@ class DomainRequest(TimeStampedModel):
self._cache_status_and_status_reasons()
def clean(self):
"""
Validates suborganization-related fields in two scenarios:
1. New suborganization request: Prevents duplicate names within same portfolio
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
enforced during both model save and form submission.
Not presently used on the domain request wizard, though.
"""
super().clean()
# Validation logic for a suborganization request
if self.is_requesting_new_suborganization():