Update portfolio.py

This commit is contained in:
zandercymatics 2024-08-14 13:33:02 -06:00
parent 5afad6b91d
commit 273cf91f76
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -124,6 +124,15 @@ class Portfolio(TimeStampedModel):
def __str__(self) -> str: def __str__(self) -> str:
return str(self.organization_name) return str(self.organization_name)
def save(self, *args, **kwargs):
"""Save override for custom properties"""
# The urbanization field is only intended for the state_territory puerto rico
if self.state_territory != self.StateTerritoryChoices.PUERTO_RICO and self.urbanization:
self.urbanization = None
super().save(*args, **kwargs)
@property @property
def portfolio_type(self): def portfolio_type(self):
""" """
@ -148,12 +157,3 @@ class Portfolio(TimeStampedModel):
def get_suborganizations(self): def get_suborganizations(self):
"""Returns all suborganizations associated with this portfolio""" """Returns all suborganizations associated with this portfolio"""
return self.portfolio_suborganizations.all() return self.portfolio_suborganizations.all()
def save(self, *args, **kwargs):
"""Save override for custom properties"""
# The urbanization field is only intended for the state_territory puerto rico
if self.state_territory != self.StateTerritoryChoices.PUERTO_RICO and self.urbanization:
self.urbanization = None
super().save(*args, **kwargs)