From 9e1ec1711b4d247510b6cd687c243e4f9653f7e1 Mon Sep 17 00:00:00 2001 From: moanos Date: Tue, 31 Dec 2024 13:38:06 +0100 Subject: [PATCH] fix: Make Search and Search subscription are not the same if Search is not localized --- src/fellchensammlung/tools/search.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fellchensammlung/tools/search.py b/src/fellchensammlung/tools/search.py index 08c05c8..1c2efcb 100644 --- a/src/fellchensammlung/tools/search.py +++ b/src/fellchensammlung/tools/search.py @@ -40,6 +40,8 @@ class Search: Only allowed to be called for located subscriptions """ + if self.location is None: + return False return self.location.name == other.location.name and self.sex == other.sex and self.max_distance == other.max_distance def _locate(self): @@ -106,7 +108,7 @@ class Search: SearchSubscription.objects.create(owner=user, location=self.location, sex=self.sex, - radius=self.max_distance) + max_distance=self.max_distance) def is_subscribed(self, user): """