summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/models/caves.py9
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)