forked from expo/troggle
More debugging and warnings
This commit is contained in:
parent
c4e2ae2395
commit
be2b17ea85
@ -8,7 +8,6 @@ import urllib.parse
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
#from django.forms.models import modelformset_factory
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
@ -38,7 +37,20 @@ class MapLocations(object):
|
||||
def points(self):
|
||||
for ent in Entrance.objects.all():
|
||||
if ent.best_station():
|
||||
areaName = ent.caveandentrance_set.all()[0].cave.getArea().short_name
|
||||
try:
|
||||
k = ent.caveandentrance_set.all()[0].cave
|
||||
except:
|
||||
message = " ! Failed to get Cave linked to Entrance:{} from:{} best:{}".format(ent.name, ent.filename, ent.best_station())
|
||||
models.DataIssue.objects.create(parser='entrances', message=message)
|
||||
print(message)
|
||||
raise
|
||||
try:
|
||||
areaName = k.getArea().short_name
|
||||
except:
|
||||
message = " ! Failed to get Area on cave '{}' linked to Entrance:{} from:{} best:{}".format(cave, ent.name, ent.filename, ent.best_station())
|
||||
models.DataIssue.objects.create(parser='entrances', message=message)
|
||||
print(message)
|
||||
raise
|
||||
self.p.append((ent.best_station(), "%s-%s" % (areaName, str(ent)[5:]), ent.needs_surface_work(), str(ent)))
|
||||
return self.p
|
||||
|
||||
@ -47,6 +59,7 @@ class MapLocations(object):
|
||||
|
||||
def getCave(cave_id):
|
||||
"""Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm."""
|
||||
# REPLACE OR MERGE this with other functions that do exactly th same thing!
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=cave_id)
|
||||
except Cave.DoesNotExist:
|
||||
@ -276,19 +289,6 @@ def surveyindex(request):
|
||||
expeditions=Expedition.objects.order_by("-year")
|
||||
return render(request,'survey.html',locals())
|
||||
|
||||
# def survey(request,year,wallet_number):
|
||||
# surveys=Survey.objects.all()
|
||||
# expeditions=Expedition.objects.order_by("-year")
|
||||
# current_expedition=Expedition.objects.filter(year=year)[0]
|
||||
|
||||
# if wallet_number!='':
|
||||
# current_survey=Survey.objects.filter(expedition=current_expedition,wallet_number=wallet_number)[0]
|
||||
# # notes=current_survey.scannedimage_set.filter(contents='notes')
|
||||
# planSketches=current_survey.scannedimage_set.filter(contents='plan')
|
||||
# elevationSketches=current_survey.scannedimage_set.filter(contents='elevation')
|
||||
|
||||
return render(request,'survey.html', locals())
|
||||
|
||||
def cave_description(request, cavedescription_name):
|
||||
cave_description = get_object_or_404(CaveDescription, short_name = cavedescription_name)
|
||||
return render(request,'cave_description.html', locals())
|
||||
|
@ -46,6 +46,12 @@ def import_survex():
|
||||
print(" - Survex entrances x/y/z Positions")
|
||||
troggle.parsers.survex.LoadPos()
|
||||
|
||||
def import_loadpos():
|
||||
# when this import is moved to the top with the rest it all crashes horribly
|
||||
import troggle.parsers.survex
|
||||
print(" - Survex entrances x/y/z Positions")
|
||||
troggle.parsers.survex.LoadPos()
|
||||
|
||||
def import_tunnelfiles():
|
||||
print("Importing Tunnel files")
|
||||
troggle.parsers.surveys.LoadTunnelFiles()
|
||||
|
Loading…
Reference in New Issue
Block a user