summaryrefslogtreecommitdiffstats
path: root/core/views/uploads.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-03-18 11:28:35 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2022-03-18 11:28:35 +0000
commitaf7fc8f2437911ac52d8243cb5d6379de3a2dd51 (patch)
treebeafb0e6bbe4ee57769f66191b27bf13edc6c76f /core/views/uploads.py
parente4ee4abce8c50f7b574b7debf09a34931cd5c7f3 (diff)
downloadtroggle-af7fc8f2437911ac52d8243cb5d6379de3a2dd51.tar.gz
troggle-af7fc8f2437911ac52d8243cb5d6379de3a2dd51.tar.bz2
troggle-af7fc8f2437911ac52d8243cb5d6379de3a2dd51.zip
use new upload page for most wallets
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r--core/views/uploads.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py
index dfaa29d..7dfa8c1 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -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}'