fix: Make Search and Search subscription are not the same if Search is not localized

This commit is contained in:
moanos [he/him] 2024-12-31 13:38:06 +01:00
parent bae4ee3d22
commit 9e1ec1711b

View File

@ -40,6 +40,8 @@ class Search:
Only allowed to be called for located subscriptions 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 return self.location.name == other.location.name and self.sex == other.sex and self.max_distance == other.max_distance
def _locate(self): def _locate(self):
@ -106,7 +108,7 @@ class Search:
SearchSubscription.objects.create(owner=user, SearchSubscription.objects.create(owner=user,
location=self.location, location=self.location,
sex=self.sex, sex=self.sex,
radius=self.max_distance) max_distance=self.max_distance)
def is_subscribed(self, user): def is_subscribed(self, user):
""" """