diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-07-25 22:14:13 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-07-25 22:14:13 +0300 |
commit | 72a6b091e6f53e11798decf2fa4365ccfd4eef50 (patch) | |
tree | f3516e3ca376de9d3be212b82979793ccb7abcc0 /core/models/caves.py | |
parent | af552a3d62aa4b3489f3c600cb30b5ef2f5c6b7c (diff) | |
download | troggle-72a6b091e6f53e11798decf2fa4365ccfd4eef50.tar.gz troggle-72a6b091e6f53e11798decf2fa4365ccfd4eef50.tar.bz2 troggle-72a6b091e6f53e11798decf2fa4365ccfd4eef50.zip |
make more robust
Diffstat (limited to 'core/models/caves.py')
-rw-r--r-- | core/models/caves.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/models/caves.py b/core/models/caves.py index 5bef08c..0d94b4c 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -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) |