diff --git a/core/views/caves.py b/core/views/caves.py index 0e4b4e8..145aeb2 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -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):