Skip to content

Commit 567968c

Browse files
committed
use geometry field instead of multipolygon for admin2
1 parent ec78cf9 commit 567968c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

api/management/commands/import-admin2-data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def add_admin2(self, options, import_missing, feature, geom, centroid, bbox):
132132
try:
133133
print("importing", admin2.name)
134134
admin2.save()
135-
if options["update_geom"]:
135+
if options["update-geom"]:
136136
self.update_geom(admin2, geom)
137137
except IntegrityError as e:
138138
print(f"Duplicate object {admin2.name}")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 3.2.16 on 2022-10-19 14:08
2+
3+
import django.contrib.gis.db.models.fields
4+
from django.db import migrations
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('api', '0157_event_image_and_summary_translations'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='admin2geoms',
16+
name='geom',
17+
field=django.contrib.gis.db.models.fields.GeometryField(blank=True, null=True, srid=4326),
18+
),
19+
]

api/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class DistrictGeoms(models.Model):
293293

294294
class Admin2Geoms(models.Model):
295295
""" Admin2 geometries """
296-
geom = models.MultiPolygonField(srid=4326, blank=True, null=True)
296+
geom = models.GeometryField(srid=4326, blank=True, null=True)
297297
admin2 = models.OneToOneField(Admin2, verbose_name=_('admin2'), on_delete=models.DO_NOTHING, primary_key=True)
298298

299299

0 commit comments

Comments
 (0)