diff options
Diffstat (limited to 'ishtar_common/management/commands/import_geofla_csv.py')
-rw-r--r-- | ishtar_common/management/commands/import_geofla_csv.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ishtar_common/management/commands/import_geofla_csv.py b/ishtar_common/management/commands/import_geofla_csv.py index 294219e9c..7ef0e0a38 100644 --- a/ishtar_common/management/commands/import_geofla_csv.py +++ b/ishtar_common/management/commands/import_geofla_csv.py @@ -65,11 +65,17 @@ class Command(BaseCommand): if 'MULTI' not in geom: geom = geom.replace('POLYGON', 'MULTIPOLYGON(') + ')' town.limit = GEOSGeometry(geom, srid=2154) - town.center = Point(float(row['X_CENTROID']), - float(row['Y_CENTROID']), srid=2154) + if 'X_CENTROID' in row: + town.center = Point(float(row['X_CENTROID']), + float(row['Y_CENTROID']), srid=2154) + else: + town.center = None if not town.year and default_year: town.year = default_year - town.surface = row['SUPERFICIE'] + if 'SUPERFICIE' in row: + town.surface = row['SUPERFICIE'] + else: + town.surface = None if not created: nb_changed += 1 town.save() |