ON s'assure que le rayon est un nombre
This commit is contained in:
parent
0542e3a695
commit
db5d8496c1
@ -142,6 +142,13 @@ class EventFilter(django_filters.FilterSet):
|
||||
p = self.get_cleaned_data("position")
|
||||
if not isinstance(d, str) or not isinstance(p, ReferenceLocation):
|
||||
return parent
|
||||
try:
|
||||
d = float(d)
|
||||
except ValueError:
|
||||
return parent
|
||||
if d <= 0:
|
||||
return parent
|
||||
|
||||
p = p.location
|
||||
|
||||
return parent.exclude(exact_location=False).filter(exact_location__location__distance_lt=(p, D(km=d)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user