From 4c9dcf7246dce21b54e5c2b174c8082bdbe13c16 Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 29 Aug 2011 17:58:21 +0530 Subject: [PATCH] feature_type is sometimes null? :/ --- gazetteer/places/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gazetteer/places/models.py b/gazetteer/places/models.py index 0da0fad..cd9ec97 100644 --- a/gazetteer/places/models.py +++ b/gazetteer/places/models.py @@ -59,10 +59,16 @@ class Feature(models.Model): def get_geojson(self): geom = json.loads(self.geometry.transform(3785, True).geojson) + + if self.feature_type is None: + feature_type = '' + else: + feature_type = self.feature_type.name + properties = { 'id': self.id, 'preferred_name': self.preferred_name, - 'feature_type': self.feature_type.name, + 'feature_type': feature_type, 'admin1': self.admin1, 'admin2': self.admin2 }