2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 09:37:20 +00:00

make ?reload private and clean old error msgs

This commit is contained in:
Philip Sargent
2021-04-23 03:07:21 +01:00
parent 1a4be0f02e
commit dbd186e299
10 changed files with 172 additions and 85 deletions

View File

@@ -41,11 +41,15 @@ def todos(request, module):
'''
from troggle.core.TESTS.tests import todo as tests
from troggle.core.views.logbooks import todo as viewlogbooks
from troggle.parsers.logbooks import todo as parserslogbooks
from troggle.core.forms import todo as forms
from troggle.core.templatetags.wiki_markup import todo as wiki
tododict = {'views/other': todo,
'tests': tests,
'views/logbooks': viewlogbooks,
'core/forms': forms}
'parsers/logbooks': parserslogbooks,
'core/forms': forms,
'core/templatetags/wiki_markup': wiki}
return render(request,'core/todos.html', {'tododict': tododict})
def troggle404(request): # cannot get this to work. Handler404 in urls.py not right syntax
@@ -215,25 +219,25 @@ def newfile(request, pslug = None):
return render(request, 'editfile.html', {'fileForm': fileform, })
@login_required_if_public
def simpleupload(request):
print(f'! - FORM simpleupload - start')
def scanupload(request, year='2050'):
print(f'! - FORM scanupload - start')
if request.method == 'POST':
form = SimpleUploadFileForm(request.POST,request.FILES)
if form.is_valid():
#form.save() # comment out so nothing saved in MEDIA_ROOT/fileuploads
f = request.FILES["simplefile"]
w = request.POST["title"]
print(f'! - FORM simpleupload uploaded {f.name}')
fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, '2021', w))
print(f'! - FORM scanupload uploaded {f.name}')
fs = FileSystemStorage(os.path.join(settings.SURVEY_SCANS, year, w))
actual_saved = fs.save(f.name, content=f) # name may chnage to avoid clash
# INSERT check if name is chnaged, to allow user to abort and rename - or lets do a chaecjk anyway.
# INSERT check if name is changed, to allow user to abort and rename - or lets do a chaecjk anyway.
print(f'! - FORM simpleupload {actual_saved}')
print(f'! - FORM scanupload {actual_saved}')
form = SimpleUploadFileForm()
return render(request, 'simpleupload.html', {'form': form,'filesaved': True, 'actual_saved': actual_saved})
return render(request, 'scanuploadform.html', {'form': form,'filesaved': True, 'actual_saved': actual_saved})
else:
form = SimpleUploadFileForm()
return render(request, 'simpleupload.html', {'form':form,})
return render(request, 'scanuploadform.html', {'form':form,})