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
This commit is contained in:
Sam Wenham
2019-04-14 22:45:31 +01:00
parent d1d0c24ed8
commit 23df89cf31
8 changed files with 37 additions and 15 deletions

View File

@@ -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)