def as_dict(self): if not self.location: return {"postcode": self.get_postcode_display()} loc = self.location result = {"postcode": self.get_postcode_display(), "wgs84_lon": loc[0], "wgs84_lat": loc[1]} if hasattr(countries, "augment_postcode"): countries.augment_postcode(self, result) return result
def as_dict(self): if not self.location: return { 'postcode': self.get_postcode_display(), } loc = self.location result = { 'postcode': self.get_postcode_display(), 'wgs84_lon': loc[0], 'wgs84_lat': loc[1] } if hasattr(countries, 'augment_postcode'): countries.augment_postcode(self, result) return result