diff options
author | Sam Wenham <sam@wenhams.co.uk> | 2019-04-14 22:45:31 +0100 |
---|---|---|
committer | Sam Wenham <sam@wenhams.co.uk> | 2019-04-14 22:45:31 +0100 |
commit | f1736c53c4142c9243d5e57d77a5d7a8d62c475b (patch) | |
tree | b2fdc953496cd2fd0b7c75fdf4e65a022b730581 /parsers/logbooks.py | |
parent | 05c5e26e9991fb3e753759c50bc1f29e3592704e (diff) | |
download | troggle-f1736c53c4142c9243d5e57d77a5d7a8d62c475b.tar.gz troggle-f1736c53c4142c9243d5e57d77a5d7a8d62c475b.tar.bz2 troggle-f1736c53c4142c9243d5e57d77a5d7a8d62c475b.zip |
Fix CSRF issues in svx form
Set date formats
Add DataIssue model and add errors to it to allow us to give people a list of
stuff to fix
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 2d1875a..bf6081f 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -7,6 +7,8 @@ from parsers.people import GetPersonExpeditionNameLookup from parsers.cavetab import GetCaveLookup from django.template.defaultfilters import slugify +from django.utils.timezone import get_current_timezone +from django.utils.timezone import make_aware import csv import re @@ -36,6 +38,8 @@ def GetTripPersons(trippeople, expedition, logtime_underground): personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower()) if not personyear: print(" - No name match for: '%s'" % tripperson) + message = "No name match for: '%s' in year '%s'" % (tripperson, expedition.year) + models.DataIssue.objects.create(parser='logbooks', message=message) res.append((personyear, logtime_underground)) if mul: author = personyear @@ -79,6 +83,8 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground) if not author: print(" - Skipping logentry: " + title + " - no author for entry") + message = "Skipping logentry: %s - no author for entry in year '%s'" % (title, expedition.year) + models.DataIssue.objects.create(parser='logbooks', message=message) return #tripCave = GetTripCave(place) |