diff --git a/src/peoplefinder/models.py b/src/peoplefinder/models.py index 58873aac7..25b626f57 100644 --- a/src/peoplefinder/models.py +++ b/src/peoplefinder/models.py @@ -837,26 +837,20 @@ def get_workdays_display(self) -> str: # "Monday, Tuesday, Wednesday, ..." return ", ".join(map(str, workdays)) - def get_office_location_display(self) -> Optional[str]: + def get_office_location_display(self) -> str: if self.international_building: return self.international_building + + location_parts = [] + + if self.location_in_building: + location_parts.append(escape(strip_tags(self.location_in_building))) + if self.uk_office_location: - location_display = ( - self.uk_office_location.building_name - + "
" - + self.uk_office_location.city - ) - if self.location_in_building: - location_display = ( - strip_tags(self.location_in_building) - + "
" - + self.uk_office_location.building_name - + "
" - + self.uk_office_location.city - ) - escape(location_display) - return mark_safe(location_display) # noqa: S308 - return None + location_parts.append(self.uk_office_location.building_name) + location_parts.append(self.uk_office_location.city) + + return mark_safe("
".join(location_parts)) # noqa: S308 def get_manager_display(self) -> Optional[str]: if self.manager: