On consolide la recherche (erreur 500 des moteurs de recherche)

This commit is contained in:
Jean-Marie Favreau 2024-12-08 16:34:41 +01:00
parent ced15d5113
commit f7f8d9cb0c

View File

@ -137,7 +137,11 @@ class EventFilter(django_filters.FilterSet):
if self.get_cleaned_data("position") is None or self.get_cleaned_data("radius") is None:
return parent
d = self.get_cleaned_data("radius")
p = self.get_cleaned_data("position").location
p = self.get_cleaned_data("position")
if not isinstance(d, str) or not isinstance(p, ReferenceLocation):
return parent
p = p.location
return parent.exclude(exact_location=False).filter(exact_location__location__distance_lt=(p, D(km=d)))
def get_url(self):
@ -188,6 +192,7 @@ class EventFilter(django_filters.FilterSet):
def get_cleaned_data(self, name):
try:
return self.form.cleaned_data[name]
except AttributeError: