diff --git a/opentech/apply/funds/blocks.py b/opentech/apply/funds/blocks.py index a2e55732d79fdb574c31f4b19c784a728ba1def7..ccc4bb0db34a97b1c08c799cc3fc907c41e28f6d 100644 --- a/opentech/apply/funds/blocks.py +++ b/opentech/apply/funds/blocks.py @@ -47,8 +47,16 @@ class AddressFieldBlock(ApplicationMustIncludeFieldBlock): icon = 'home' def format_data(self, data): + # Based on the fields listed in addressfields/widgets.py + order_fields = [ + 'thoroughfare', 'premise', 'localityname', 'administrativearea', 'postalcode', 'country' + ] address = json.loads(data) - return ', '.join(address.values()) + return ', '.join( + address[field] + for field in order_fields + if address[field] + ) class FullNameBlock(ApplicationMustIncludeFieldBlock):