mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 21:17:07 +00:00
use new upload page for most wallets
This commit is contained in:
@@ -2,6 +2,7 @@ import re, os
|
||||
import subprocess
|
||||
import json
|
||||
import settings
|
||||
import urllib
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
@@ -15,6 +16,7 @@ from django.shortcuts import render
|
||||
from django.template import Context, loader
|
||||
from django.core.files.storage import FileSystemStorage, default_storage
|
||||
|
||||
|
||||
#from troggle import settings
|
||||
from troggle.parsers.imports import import_caves, import_people, import_surveyscans
|
||||
from troggle.parsers.imports import import_logbooks, import_QMs, import_drawingsfiles, import_survex
|
||||
@@ -24,6 +26,8 @@ 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 .auth import login_required_if_public
|
||||
#from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt
|
||||
|
||||
@@ -88,7 +92,7 @@ xlate = {"url": "description url",
|
||||
}
|
||||
|
||||
@login_required_if_public
|
||||
def scanupload(request, wallet=None):
|
||||
def scanupload(request, path=None):
|
||||
'''Upload scanned image files into a wallet on /expofiles
|
||||
Also display and edit the contents.json data in the wallet.
|
||||
|
||||
@@ -100,14 +104,22 @@ def scanupload(request, wallet=None):
|
||||
|
||||
checkboxes = ["description written", "survex not required", "qms written", "website updated",
|
||||
"plan not required", "plan drawn", "elev not required", "elev drawn", "electronic survey" ]
|
||||
if path:
|
||||
wallet = urllib.parse.unquote(path)
|
||||
else:
|
||||
wallet = "2022#01" # improve this later
|
||||
|
||||
# print(f'! - FORM scanupload - start {wallet}')
|
||||
if wallet is None:
|
||||
wallet = "2021#01" # improve this later
|
||||
if not re.match('(19|20)\d\d:\d\d', wallet):
|
||||
wallet = "2021:01" # improve this later
|
||||
|
||||
year = wallet[:4]
|
||||
if int(year) <= 1999:
|
||||
print(f'! - FORM scanupload - start {wallet} REDIRECT TO OLDWALLET')
|
||||
return(oldwallet(request, path))
|
||||
|
||||
if not re.match('(19|20)\d\d[:#]\d\d', wallet):
|
||||
wallet = "2022:01" # improve this later
|
||||
print(f'! - FORM scanupload - start {wallet}')
|
||||
|
||||
if path:
|
||||
print(f'! - FORM scanupload - start wallet:{wallet}: path:{path}:')
|
||||
if int(year) < 1977:
|
||||
year = "1977"
|
||||
if int(year) > 2050:
|
||||
@@ -115,6 +127,7 @@ def scanupload(request, wallet=None):
|
||||
nexty = f'{int(year)+1}'
|
||||
prevy = f'{int(year)-1}'
|
||||
|
||||
|
||||
wnumber = wallet[5:]
|
||||
next = f'{int(wnumber)+1:02d}'
|
||||
prev = f'{int(wnumber)-1:02d}'
|
||||
|
||||
Reference in New Issue
Block a user