diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-04-21 22:09:20 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-04-21 22:09:20 +0100 |
commit | 1968db62ad9bdc41f52afc26a8a929f5aeca4a19 (patch) | |
tree | 0d8b045ad795e69ae216946d4758ac06f801d5fb /logbooksdump.py | |
parent | bcdb3572fa260052d76b54961dea9a9381381311 (diff) | |
download | troggle-1968db62ad9bdc41f52afc26a8a929f5aeca4a19.tar.gz troggle-1968db62ad9bdc41f52afc26a8a929f5aeca4a19.tar.bz2 troggle-1968db62ad9bdc41f52afc26a8a929f5aeca4a19.zip |
archeology on the logbook entry editing forms
Diffstat (limited to 'logbooksdump.py')
-rw-r--r-- | logbooksdump.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/logbooksdump.py b/logbooksdump.py index a2a4d8e..4df4c93 100644 --- a/logbooksdump.py +++ b/logbooksdump.py @@ -22,6 +22,11 @@ from troggle.core.models.caves import Cave, Entrance # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def import_auto_logbooks(): + '''For logbook entries which have been 'typed up' by entering the data in a form, + which makes a copy of the LBE in years/<year>/autologbook/<tripname>.html + this will then re-import all thoise individual LBE files. + Gosh. How complicated. Thank goodness we don't do anything like this anymore. + ''' import os import troggle.parsers.logbooks @@ -42,8 +47,13 @@ def import_auto_logbooks(): # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #Temporary function until definitive source of data transfered. from django.template.defaultfilters import slugify -from django.template import Context, loader +from django.template import loader def dumplogbooks(): + '''This appears to take all the LBEs in the database and to write them all out as infividual html files + so that they can be re-imported. + This is the sort of silly thing you have to do when you started out thinking that the database was + going to be the Source Of All Truth and then retrofitting to make inthe input files be the master. + ''' def get_name(pe): if pe.nickname: return pe.nickname @@ -68,10 +78,10 @@ def dumplogbooks(): persons = [{"name": get_name(pt.personexpedition), "TU": pt.time_underground, "author": pt.is_logbook_entry_author} for pt in pts] f = open(filename, "wb") template = loader.get_template('dataformat/logbookentry.html') - context = Context({'trip': trip, + context = {'trip': trip, 'persons': persons, 'date': dateStr, - 'expeditionyear': lbe.expedition.year}) + 'expeditionyear': lbe.expedition.year} output = template.render(context) f.write(str(output).encode( "utf-8" )) f.close() |