import MapUpdate locally so MapHistory can be imported without Django
This commit is contained in:
parent
2216411494
commit
302a90d2e0
1 changed files with 2 additions and 1 deletions
|
@ -13,7 +13,6 @@ from shapely.geometry import box
|
||||||
from shapely.geometry.base import BaseGeometry
|
from shapely.geometry.base import BaseGeometry
|
||||||
from shapely.ops import unary_union
|
from shapely.ops import unary_union
|
||||||
|
|
||||||
from c3nav.mapdata.models import MapUpdate
|
|
||||||
from c3nav.mapdata.utils.models import get_submodels
|
from c3nav.mapdata.utils.models import get_submodels
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,6 +220,7 @@ class MapHistory(GeometryIndexed):
|
||||||
instance = super().open(filename)
|
instance = super().open(filename)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
if default_update is None:
|
if default_update is None:
|
||||||
|
from c3nav.mapdata.models import MapUpdate
|
||||||
default_update = MapUpdate.last_processed_update()
|
default_update = MapUpdate.last_processed_update()
|
||||||
instance = cls(updates=[default_update], filename=filename)
|
instance = cls(updates=[default_update], filename=filename)
|
||||||
instance.save()
|
instance.save()
|
||||||
|
@ -241,6 +241,7 @@ class MapHistory(GeometryIndexed):
|
||||||
@classmethod
|
@classmethod
|
||||||
def open_level_cached(cls, level_id, mode):
|
def open_level_cached(cls, level_id, mode):
|
||||||
with cls.cache_lock:
|
with cls.cache_lock:
|
||||||
|
from c3nav.mapdata.models import MapUpdate
|
||||||
cache_key = MapUpdate.current_processed_cache_key()
|
cache_key = MapUpdate.current_processed_cache_key()
|
||||||
if cls.cache_key != cache_key:
|
if cls.cache_key != cache_key:
|
||||||
cls.cache_key = cache_key
|
cls.cache_key = cache_key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue