diff --git a/core/models.py b/core/models.py index 73063b2..87f8ea9 100644 --- a/core/models.py +++ b/core/models.py @@ -451,10 +451,12 @@ class Cave(TroggleModel): return res def getCaveByReference(reference): - print reference areaname, code = reference.split("-", 1) + print areaname, code area = Area.objects.get(short_name = areaname) + print area foundCaves = list(Cave.objects.filter(area = area, kataster_number = code).all()) + list(Cave.objects.filter(area = area, unofficial_number = code).all()) + print list(foundCaves) assert len(foundCaves) == 1 return foundCaves[0] diff --git a/templates/csrffaker.py b/templates/csrffaker.py new file mode 100644 index 0000000..86b1318 --- /dev/null +++ b/templates/csrffaker.py @@ -0,0 +1,9 @@ +import django +if django.VERSION[0] >=1 and django.VERSION[1] > 1: + pass +else: + from django import template + + register = template.Library() + @register.tag + def csrf_token(parser, token): return "" diff --git a/templates/newlogbookentry.html b/templates/newlogbookentry.html index 099ae2b..4e8eda6 100644 --- a/templates/newlogbookentry.html +++ b/templates/newlogbookentry.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load csrffaker %} {% block title %}Logbook {{logbookentry.id}}{% endblock %} {% block head %}