2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 16:51:54 +00:00
This commit is contained in:
Philip Sargent 2022-07-21 00:07:52 +03:00
parent d058942084
commit 83bbda7c40

View File

@ -483,7 +483,7 @@ def qm(request,cave_id,qm_id,year,grade=None, blockname=None):
year=int(year)
if blockname == '':
if blockname == '' or not blockname:
# CSV import QMs, use old technique
try:
c=getCave(cave_id)
@ -492,7 +492,7 @@ def qm(request,cave_id,qm_id,year,grade=None, blockname=None):
return render(request,'qm.html', {'qm': qm})
except QM.DoesNotExist:
#raise
return render(request,'errors/badslug.html', {'badslug': f'{cave_id=} {year=} {qm_id=} {blockname=}'})
return render(request,'errors/badslug.html', {'badslug': f'QM.DoesNotExist blockname is empty string: {cave_id=} {year=} {qm_id=} {grade=} {blockname=}'})
else:
try:
@ -513,13 +513,13 @@ def qm(request,cave_id,qm_id,year,grade=None, blockname=None):
return render(request,'qm.html', {'qm': qm})
else:
#raise
return render(request,'errors/badslug.html', {'badslug': f'{cave_id=} {year=} {qm_id=} {blockname=}'})
return render(request,'errors/badslug.html', {'badslug': f'Failed get {cave_id=} {year=} {qm_id=} {grade=} {blockname=}'})
except MultipleObjectsReturned:
message = f'Multiple QMs with the same cave, year, number, grade AND first 8 chars of the survexblock name. (Could be caused by incomplete databasereset). Fix this in the survex file(s). {cave_id=} {year=} {qm_id=} {blockname=}'
return render(request,'errors/generic.html', {'message': message})
except QM.DoesNotExist:
#raise
return render(request,'errors/badslug.html', {'badslug': f'{cave_id=} {year=} {qm_id=} {blockname=}'})
return render(request,'errors/badslug.html', {'badslug': f'QM.DoesNotExist blockname is not empty string {cave_id=} {year=} {qm_id=} {grade=} {blockname=}'})
# def get_qms(request, caveslug):