From e77aa9fb84192bcb0813589589130fb7c1b29c0f Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Fri, 21 Feb 2020 15:57:07 +0000 Subject: Changes needed to stop the survex parser having to go through the data twice Taken from the Django 1.10 upgrade branch --- core/models.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/models.py b/core/models.py index f65efed..32b094a 100644 --- a/core/models.py +++ b/core/models.py @@ -535,13 +535,15 @@ class Cave(TroggleModel): def getCaveByReference(reference): areaname, code = reference.split("-", 1) - print(areaname, code) + #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(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] + if len(foundCaves) == 1: + return foundCaves[0] + else: + return False class OtherCaveName(TroggleModel): name = models.CharField(max_length=160) -- cgit v1.2.3