feature_type is sometimes null? :/

This commit is contained in:
Sanj 2011-08-29 17:58:21 +05:30
parent 7a90d8ede4
commit 4c9dcf7246

View File

@ -59,10 +59,16 @@ class Feature(models.Model):
def get_geojson(self): def get_geojson(self):
geom = json.loads(self.geometry.transform(3785, True).geojson) 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 = { properties = {
'id': self.id, 'id': self.id,
'preferred_name': self.preferred_name, 'preferred_name': self.preferred_name,
'feature_type': self.feature_type.name, 'feature_type': feature_type,
'admin1': self.admin1, 'admin1': self.admin1,
'admin2': self.admin2 'admin2': self.admin2
} }