2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

make more robust

This commit is contained in:
Philip Sargent 2023-07-25 22:14:13 +03:00
parent af552a3d62
commit 72a6b091e6

View File

@ -318,9 +318,12 @@ class Entrance(TroggleModel):
except:
stations = SurvexStation.objects.filter(name = station)
print(f" # MULTIPLE stations found with same name '{station}' in Entrance {self}:")
for s in stations:
print(f" # {s.id=} - {s.name} {s.latlong()}") # .id is Django internal field, not one of ours
return stations[0]
if len(stations) > 1:
for s in stations:
print(f" # {s.id=} - {s.name} {s.latlong()}") # .id is Django internal field, not one of ours
return stations[0]
else:
return None
def exact_location(self):
return self.single(self.exact_station)