mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 05:55:06 +00:00
SurvexBlocks now importing in deatil
This commit is contained in:
@@ -192,6 +192,8 @@ def readcave(filename):
|
||||
url = url[0],
|
||||
filename = filename)
|
||||
except:
|
||||
# this slow db query happens on every cave, but on import we have all this in memory
|
||||
# and don't need to do a db query. Fix this to speed it up!
|
||||
# need to cope with duplicates
|
||||
print(" ! FAILED to get only one CAVE when updating using: "+filename)
|
||||
kaves = models_caves.Cave.objects.all().filter(kataster_number=kataster_number[0])
|
||||
@@ -206,6 +208,8 @@ def readcave(filename):
|
||||
c = k
|
||||
|
||||
for area_slug in areas:
|
||||
# this slow db query happens on every cave, but on import we have all this in memory
|
||||
# and don't need to do a db query. Fix this to speed it up!
|
||||
area = models_caves.Area.objects.filter(short_name = area_slug)
|
||||
if area:
|
||||
newArea = area[0]
|
||||
@@ -216,6 +220,8 @@ def readcave(filename):
|
||||
primary = True
|
||||
for slug in slugs:
|
||||
try:
|
||||
# this slow db query happens on every cave, but on import we have all this in memory
|
||||
# and don't need to do a db query. Fix this to speed it up!
|
||||
cs = models_caves.CaveSlug.objects.update_or_create(cave = c,
|
||||
slug = slug,
|
||||
primary = primary)
|
||||
@@ -225,10 +231,13 @@ def readcave(filename):
|
||||
print(message)
|
||||
|
||||
primary = False
|
||||
|
||||
for entrance in entrances:
|
||||
slug = getXML(entrance, "entranceslug", maxItems = 1, context = context)[0]
|
||||
letter = getXML(entrance, "letter", maxItems = 1, context = context)[0]
|
||||
try:
|
||||
# this slow db query happens on every entrance, but on import we have all this in memory
|
||||
# and don't need to do a db query. Fix this to speed it up!
|
||||
entrance = models_caves.Entrance.objects.get(entranceslug__slug = slug)
|
||||
ce = models_caves.CaveAndEntrance.objects.update_or_create(cave = c, entrance_letter = letter, entrance = entrance)
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user