diff options
Diffstat (limited to 'core/views/other.py')
-rw-r--r-- | core/views/other.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/views/other.py b/core/views/other.py index b590f21..167e0b2 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -181,7 +181,16 @@ def exportlogbook(request,year=None,extension=None): response['Content-Disposition'] = 'attachment; filename='+filename t=loader.get_template(template) logbookfile = (t.render({'logbook_entries':logbook_entries})) - + + endpath = Path(settings.EXPOWEB, "years", year, "endmatter.html") + endmatter = "" + if endpath.is_file(): + try: + with open(endpath,"r") as end: + endmatter = end.read() + except: + print(" ! Very Bad Error opening " + endpath) + frontpath = Path(settings.EXPOWEB, "years", year, "frontmatter.html") if frontpath.is_file(): try: @@ -189,9 +198,9 @@ def exportlogbook(request,year=None,extension=None): frontmatter = front.read() except: print(" ! Very Bad Error opening " + frontpath) - logbookfile = re.sub(r"<body>", "<body>\n"+frontmatter , logbookfile) + logbookfile = re.sub(r"<body>", "<body>\n"+frontmatter+endmatter , logbookfile) else: - logbookfile = re.sub(r"<body>", f"<body>\n<h1>Expo {year}</h1>\n", logbookfile) + logbookfile = re.sub(r"<body>", f"<body>\n<h1>Expo {year}</h1>\n"+endmatter, logbookfile) dir = Path(settings.EXPOWEB) / "years" / year |