Skip to content

Commit

Permalink
Fix countries ref
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Dec 12, 2024
1 parent 0c5a167 commit 7dac271
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,11 +819,15 @@ def get_postcode_data(self) -> Optional[PostcodesIOResult]:

return self.postcode_data

@cached_property
def external_data_source(self):
return self.data_type.data_set.external_data_source

def save(self, *args, **kwargs):
if self.phone:
try:
self.phone = validate_and_format_phone_number(
self.phone, ExternalDataSource.countries
self.phone, self.external_data_source.countries
)
except ValidationError as e:
raise ValidationError({"phone": f"Invalid phone number: {e}"})
Expand Down

0 comments on commit 7dac271

Please sign in to comment.