From ed2cedaa870764e32f3e4b533ff7a25ebdeb7dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Thu, 19 Oct 2017 14:41:42 +0200 Subject: [PATCH] rebuild altitudes and level geoms on mapupdate --- .../commands/{clearcache.py => clearmapcache.py} | 0 .../mapdata/management/commands/compilealtitudes.py | 9 --------- .../mapdata/management/commands/rebuildgeometries.py | 9 --------- src/c3nav/mapdata/models/update.py | 6 ++++++ 4 files changed, 6 insertions(+), 18 deletions(-) rename src/c3nav/mapdata/management/commands/{clearcache.py => clearmapcache.py} (100%) delete mode 100644 src/c3nav/mapdata/management/commands/compilealtitudes.py delete mode 100644 src/c3nav/mapdata/management/commands/rebuildgeometries.py diff --git a/src/c3nav/mapdata/management/commands/clearcache.py b/src/c3nav/mapdata/management/commands/clearmapcache.py similarity index 100% rename from src/c3nav/mapdata/management/commands/clearcache.py rename to src/c3nav/mapdata/management/commands/clearmapcache.py diff --git a/src/c3nav/mapdata/management/commands/compilealtitudes.py b/src/c3nav/mapdata/management/commands/compilealtitudes.py deleted file mode 100644 index e1e48df8..00000000 --- a/src/c3nav/mapdata/management/commands/compilealtitudes.py +++ /dev/null @@ -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() diff --git a/src/c3nav/mapdata/management/commands/rebuildgeometries.py b/src/c3nav/mapdata/management/commands/rebuildgeometries.py deleted file mode 100644 index a9da9237..00000000 --- a/src/c3nav/mapdata/management/commands/rebuildgeometries.py +++ /dev/null @@ -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() diff --git a/src/c3nav/mapdata/models/update.py b/src/c3nav/mapdata/models/update.py index d2f1505a..92a6eda1 100644 --- a/src/c3nav/mapdata/models/update.py +++ b/src/c3nav/mapdata/models/update.py @@ -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)