forked from expo/troggle
Fix scanned walletindex pages
This commit is contained in:
parent
af7fc8f243
commit
8b889ade5f
@ -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
|
||||
'''
|
||||
|
@ -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
|
||||
|
@ -53,6 +53,8 @@
|
||||
<a href="/expofiles/surveyscans/{{year}}/{{wallet|urlencode}}/walletindex.html">Wallet status page</a>
|
||||
<br />
|
||||
<a href="/expofiles/surveyscans/{{year}}/walletindex.html">Wallet index for this year</a>
|
||||
<br />
|
||||
<a href="/expedition/{{year}}">Logbook entries, Survex files for this year</a>
|
||||
</em>
|
||||
|
||||
</div>
|
||||
|
@ -1,3 +1,4 @@
|
||||
<!-- wallet_old.html - this text visible because this template has been included -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Survey Scans Wallet {% endblock %}
|
||||
{% block content %}
|
||||
|
29
templates/walletindex.html
Normal file
29
templates/walletindex.html
Normal file
@ -0,0 +1,29 @@
|
||||
<!-- walletindex.html - this text visible because this template has been included -->
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Wallet Scanned Index Pages{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<h3>Wallet Index Scanned Pages: {{wallet.walletname|slice:'0:4'}}</h3>
|
||||
|
||||
<table>
|
||||
{% for singlescan in wallet.singlescan_set.all %}
|
||||
<tr>
|
||||
<td class="singlescan"><a href="{{singlescan.get_absolute_url}}">{{singlescan.name}}</a></td>
|
||||
<td>
|
||||
{% for survexblock in singlescan.survexblock_set.all %}
|
||||
{{survexblock}}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<p><em>
|
||||
<a href="/expofiles/surveyscans/{{wallet.walletname|slice:'0:4'}}/walletindex.html">Wallet index for this year</a> {{wallet.walletname|slice:'0:4'}}
|
||||
<br />
|
||||
<a href="/expedition/{{wallet.walletname|slice:'0:4'}}">Expedition page for this year </a> {{wallet.walletname|slice:'0:4'}}
|
||||
<br />
|
||||
<a href="/scanupload/{{wallet.walletname|slice:'0:4'}}:01">First wallet for this year </a> {{wallet.walletname|slice:'0:4'}}
|
||||
</em>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user