From 3393db0fbc69556ad09a18b840b6cf10eaf4f52c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 1 May 2021 18:35:08 +0100 Subject: Bigger buttons, phone compatible --- core/views/other.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core/views/other.py') diff --git a/core/views/other.py b/core/views/other.py index 0d096f2..c7d7eda 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -200,8 +200,7 @@ def ajax_test(request): -class MyForm(forms.Form): # not a model-form - title = forms.CharField(max_length=20) +class MyForm(forms.Form): # not a model-form, just a form-form scanfiles = forms.FileField() @login_required_if_public @@ -218,8 +217,13 @@ def scanupload(request, wallet=None): wallet = "2021:01" # improve this later year = wallet[:4] + if int(year) < 1977: + year = "1977" + if int(year) > 2050: + year = "2050" 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}' @@ -235,11 +239,9 @@ def scanupload(request, wallet=None): if request.method == 'POST': form = MyForm(request.POST,request.FILES) if form.is_valid(): - #form.save() # comment out so nothing saved in MEDIA_ROOT/fileuploads f = request.FILES["scanfiles"] - w = request.POST["title"] multiple = request.FILES.getlist('scanfiles') - fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, w)) + fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, wallet)) actual_saved = [] if multiple: -- cgit v1.2.3