summaryrefslogtreecommitdiffstats
path: root/core/views/other.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-23 11:43:25 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-23 11:43:25 +0100
commit343d6cf35060c580a9e7cd91605bf481c4f6444b (patch)
treea4be557874fae6c6981fcfa4e500b545df58d82b /core/views/other.py
parentdbd186e299fecd8f10f3dca0a88b78f842b0c59b (diff)
downloadtroggle-343d6cf35060c580a9e7cd91605bf481c4f6444b.tar.gz
troggle-343d6cf35060c580a9e7cd91605bf481c4f6444b.tar.bz2
troggle-343d6cf35060c580a9e7cd91605bf481c4f6444b.zip
delete old forms, templates. fix logdataissues
Diffstat (limited to 'core/views/other.py')
-rw-r--r--core/views/other.py62
1 files changed, 10 insertions, 52 deletions
diff --git a/core/views/other.py b/core/views/other.py
index 9a12b1d..45d781c 100644
--- a/core/views/other.py
+++ b/core/views/other.py
@@ -22,17 +22,19 @@ Also has code to download a logbook in a choice of formats (why?!) and to
download all QMs (not working)
'''
-todo = '''Delete the newfile & TripForm code once we have a proper file-upload system working.
-meanwhile keep it as an example to consider.
+todo = '''
+- Check that the logbookdownloader works by testing with a round trip.
-Check that the logbookdownloader works by testing with a round trip.
+- Use it to convert all older logbooks into the 2005-variant of HTML then we can
+ get rid of the parsers for older formats. There are no images stored in the database,
+ so this is only a tool for a first pass, to be followed by extensive hand-editing!
+ When we have done all the old logbooks, delete this function and the two templates.
-Use it to convert all older logbooks into the 2005-variant of HTML then we can
-get rid of the parsers for older formats. There are no images stored in the database,
-so this is only a tool for a first pass, to be followed by extensive hand-editing!
-When we have done all the old logbooks, delete this function and the two templates.
+- But how does this interact with troggle/logbooksdump.py ?
+
+- deleted nefile() - check on deleted UploadFileForm using the editfile.html template which is about re-submitting
+ a LBE aka TripReport
-But how does this interact with troggle/logbooksdump.py ?S
'''
def todos(request, module):
@@ -175,50 +177,6 @@ def ajax_QM_number(request):
return HttpResponse(res)
@login_required_if_public
-def newfile(request, pslug = None):
- '''
- If not POST, it goes straight to UploadFileForm using the editfile.html template which is about re-submitting
- a LBE aka TripReport
-
- If it is POST, then it is a new LBE so an HTML formatted version of it is produced, using template.render()
- and a format 'dataformat/logbookentry.html' which is then put in expoweb/years<year>/autologbook/<LBEnamedfile>
- '''
- if pslug:
- previousfile = LogbookEntry.objects.get(slug = pslug, date = previousdate, expedition = expedition)
- if request.method == 'POST': # If the form has been submitted...
- tripForm = TripForm(request.POST) # A form bound to the POST data
- personTripFormSet = PersonTripFormSet(request.POST)
- if tripForm.is_valid() and personTripFormSet.is_valid(): # All validation rules pass
- dateStr = tripForm.cleaned_data["date"].strftime("%Y-%m-%d")
- directory = os.path.join(settings.EXPOWEB,
- "years",
- expedition.year,
- "autologbook")
- filename = os.path.join(directory,
- dateStr + "." + slugify(tripForm.cleaned_data["title"])[:50] + ".html")
- if not os.path.isdir(directory):
- os.mkdir(directory)
- if pslug and pdate:
- delLogbookEntry(previouslbe)
- f = open(filename, "w")
- template = loader.get_template('dataformat/logbookentry.html')
- context = {'trip': tripForm.cleaned_data,
- 'persons': personTripFormSet.cleaned_data,
- 'date': dateStr,
- 'expeditionyear': expeditionyear}
- f.write(template.render(context))
- f.close()
- print(logbookparsers.parseAutoLogBookEntry(filename))
- return HttpResponseRedirect(reverse('expedition', args=[expedition.year])) # Redirect after POST
- else:
- if pslug:
- pass
- else:
- fileform = UploadFileForm() # An unbound form
-
- return render(request, 'editfile.html', {'fileForm': fileform, })
-
-@login_required_if_public
def scanupload(request, year='2050'):
print(f'! - FORM scanupload - start')
if request.method == 'POST':