fix space geometries broken by bug in editor
This commit is contained in:
parent
d7ab4e02b3
commit
6125ea6d65
1 changed files with 23 additions and 0 deletions
23
src/c3nav/mapdata/migrations/0002_fix_broken_spaces.py
Normal file
23
src/c3nav/mapdata/migrations/0002_fix_broken_spaces.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 2.1.4 on 2018-12-10 22:38
|
||||
|
||||
from django.db import migrations
|
||||
from shapely.geometry import Polygon
|
||||
|
||||
|
||||
def fix_broken_spaces(apps, schema_editor):
|
||||
Space = apps.get_model('mapdata', 'Space')
|
||||
for space in Space.objects.all():
|
||||
geometry = space.geometry
|
||||
space.geometry = Polygon(shell=geometry.exterior)
|
||||
space.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mapdata', '0001_squashed_2018'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(fix_broken_spaces, migrations.RunPython.noop)
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue