I'm using django-google-maps to get the the location of a place. In models i have this field:
models.py
class PlaceLocation(models.Model):
name = models.CharField(max_length=200)
address = map_fields.AddressField(max_length=200)
geolocation = map_fields.GeoLocationField(max_length=100)
When i add an address it automatically finds the latitude and longitude in this format: 44.4385334,26.005750199999966
I want to use django filter backend to filter by latitude and longitude, but i can't get the values separated.
filters.py
class LocationFilter(django_filters.FilterSet):
ids = NumberInFilter(name='id', lookup_expr='in')
geolocation = django_filters.NumberFilter(name='geolocation', lookup_expr='iexact')
If i access:
'http://127.0.0.1:8000/locations/places/' it will show me all the places.
'http://127.0.0.1:8000/locations/places/?geolocation=44.4385334,26.005750199999966' it's giving me an empty list.
How can i get the values separated so i can filter like this: 'http://127.0.0.1:8000/locations/places/?lat=44.4385334&long=26.005750199999966'
PlaceLocation.objects.filter(...)- Sherpa