summaryrefslogtreecommitdiffstats
path: root/core/views_survex.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-03-25 16:15:26 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2021-03-25 16:15:26 +0000
commit8723d62addda7200e26bd20c6aafb1532d1f832c (patch)
tree6cfdea724b74c9e9c086937b6be5a7d7dbc72b78 /core/views_survex.py
parent213ada4ae92f6e97f7e159d7af93f8bf49f9dc67 (diff)
downloadtroggle-8723d62addda7200e26bd20c6aafb1532d1f832c.tar.gz
troggle-8723d62addda7200e26bd20c6aafb1532d1f832c.tar.bz2
troggle-8723d62addda7200e26bd20c6aafb1532d1f832c.zip
Survex files subdirectories displayed differently
Diffstat (limited to 'core/views_survex.py')
-rw-r--r--core/views_survex.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/core/views_survex.py b/core/views_survex.py
index 31b9583..89831e1 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -368,8 +368,8 @@ def survexcaveslist(request):
lsurvdirobj = [ ]
for lsubsvx in dsubsvx:
lsurvdirobj.append(("caves-1623/"+cavedir+"/"+subdir+"/"+lsubsvx, lsubsvx))
- if len(dsubsvx) > 1:
- subsurvdirs.append((lsurvdirobj[0], lsurvdirobj[1:]))
+ if len(dsubsvx) >= 1:
+ subsurvdirs.append((subdir,lsurvdirobj[0], lsurvdirobj[0:])) # list now includes the first item too
subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))
# multifile caves
@@ -381,27 +381,31 @@ def survexcaveslist(request):
return render_to_response('svxfilecavelist.html', {'settings': settings, "onefilecaves":onefilecaves, "multifilecaves":multifilecaves, "subdircaves":subdircaves })
-
-# parsing all the survex files of a single cave and showing that it's consistent and can find all the files and people
-
-# currently not showing Explorers or Titles. link test from SurvexFile page is "dates and explorers"
-# Should explicity fix the kataster number thing.
def survexcavesingle(request, survex_cave):
- print(">>>", survex_cave)
+ '''parsing all the survex files of a single cave and showing that it's consistent and can find all
+ the files and people. Currently not showing Explorers or Titles. link test from SurvexFile page
+ is "dates and explorers". Should explicity fix the kataster number thing.
+ '''
+ sc = survex_cave
breload = False
if breload:
- parsers.survex.ReloadSurvexCave(survex_cave) # does not exit now, needs re-writing to work.
+ parsers.survex.ReloadSurvexCave(sc) # does not exit now, needs re-writing to work.
try:
- cave = Cave.objects.get(kataster_number=survex_cave)
- for survexdirectory in cave.survexdirectory_set.all:
- print(">>> >>>", survexdirectory, flush=True)
+ cave = Cave.objects.get(kataster_number=sc)
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
except ObjectDoesNotExist:
# can get here if the survex file is in a directory labelled with unofficial number not kataster number.
- cave = Cave.objects.get(unofficial_number=survex_cave)
- return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
- # should produce useful error message for person trying to upload or manage survex files
+ # maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 ??
+ for unoff in [sc, sc.replace('-','_'), sc.replace('_','-')]:
+ try:
+ cave = Cave.objects.get(unofficial_number=unoff)
+ return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
+ except ObjectDoesNotExist:
+ continue
+ return render_to_response('svxcavesingle404.html', {'settings': settings, "cave":sc })
+
except:
- raise Http404()
+ return render_to_response('svxcavesingle404.html', {'settings': settings, "cave":sc })
+