diff --git a/core/views/scans.py b/core/views/scans.py index 9bf1edc..4b35377 100644 --- a/core/views/scans.py +++ b/core/views/scans.py @@ -32,6 +32,18 @@ def oldwallet(request, path): message = f'Scan folder error or not found \'{path}\' .' return render(request, 'errors/generic.html', {'message': message}) +def walletindex(request, path): + '''All years: special 'wallet' for scanned index pages + ''' + # print([ s.walletname for s in Wallet.objects.all() ]) + print(f'! - walletindex path:{path}') + try: + wallet = Wallet.objects.get(walletname=urlunquote(path)) + return render(request, 'walletindex.html', { 'wallet':wallet, 'settings': settings }) + except: + message = f'Scan folder error or not found \'{path}\' .' + return render(request, 'errors/generic.html', {'message': message}) + def scansingle(request, path, file): '''sends a single binary file to the user for display - browser decides how using mimetype ''' diff --git a/core/views/uploads.py b/core/views/uploads.py index 7dfa8c1..58b61c2 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -26,7 +26,7 @@ from troggle.core.models.troggle import DataIssue from troggle.core.models.troggle import Expedition, Person, PersonExpedition from troggle.core.models.caves import LogbookEntry, QM, Cave, PersonTrip from troggle.core.models.survex import DrawingFile -from troggle.core.views.scans import oldwallet +from troggle.core.views.scans import oldwallet, walletindex from .auth import login_required_if_public #from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt @@ -111,8 +111,12 @@ def scanupload(request, path=None): year = wallet[:4] if int(year) <= 1999: - print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET') + #print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET') return(oldwallet(request, path)) + + if str(wallet).lower().endswith('indexpages'): + print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET') + return(walletindex(request, path)) if not re.match('(19|20)\d\d[:#]\d\d', wallet): wallet = "2022:01" # improve this later diff --git a/templates/scanuploadform.html b/templates/scanuploadform.html index 00f40bd..8c3837f 100644 --- a/templates/scanuploadform.html +++ b/templates/scanuploadform.html @@ -53,6 +53,8 @@ Wallet status page
Wallet index for this year +
+Logbook entries, Survex files for this year diff --git a/templates/wallet_old.html b/templates/wallet_old.html index 7bfac41..e58009a 100644 --- a/templates/wallet_old.html +++ b/templates/wallet_old.html @@ -1,3 +1,4 @@ + {% extends "base.html" %} {% block title %}Survey Scans Wallet {% endblock %} {% block content %} diff --git a/templates/walletindex.html b/templates/walletindex.html new file mode 100644 index 0000000..f2e5c99 --- /dev/null +++ b/templates/walletindex.html @@ -0,0 +1,29 @@ + +{% extends "base.html" %} +{% block title %}Wallet Scanned Index Pages{% endblock %} +{% block content %} + +

Wallet Index Scanned Pages: {{wallet.walletname|slice:'0:4'}}

+ + +{% for singlescan in wallet.singlescan_set.all %} + + + + +{% endfor %} +
{{singlescan.name}} + {% for survexblock in singlescan.survexblock_set.all %} + {{survexblock}} + {% endfor %} +
+ +

+Wallet index for this year {{wallet.walletname|slice:'0:4'}} +
+Expedition page for this year {{wallet.walletname|slice:'0:4'}} +
+First wallet for this year {{wallet.walletname|slice:'0:4'}} +
+ +{% endblock %}