rebuild altitudes and level geoms on mapupdate

This commit is contained in:
Laura Klünder 2017-10-19 14:41:42 +02:00
parent 239708af31
commit ed2cedaa87
4 changed files with 6 additions and 18 deletions

View file

@ -1,9 +0,0 @@
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'recalculate the map altitudes'
def handle(self, *args, **options):
from c3nav.mapdata.models import AltitudeArea
AltitudeArea.recalculate()

View file

@ -1,9 +0,0 @@
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'rebuild level geometries'
def handle(self, *args, **options):
from c3nav.mapdata.render.base import LevelGeometries
LevelGeometries.rebuild()

View file

@ -46,5 +46,11 @@ class MapUpdate(models.Model):
def save(self, **kwargs):
if self.pk is not None:
raise TypeError
from c3nav.mapdata.models import AltitudeArea
from c3nav.mapdata.render.base import LevelGeometries
AltitudeArea.recalculate()
LevelGeometries.rebuild()
super().save(**kwargs)
cache.set('mapdata:last_update', (self.pk, self.datetime), 900)