Framework integration
/
Django
Jul 02, 2025
Geo-search
Use the geo_field attribute to localize your record.
geo_field should be a callable that returns a tuple (latitude, longitude).
For example:
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Contact(models.Model):
name = models.CharField(max_length=20)
lat = models.FloatField()
lng = models.FloatField()
def location(self):
return (self.lat, self.lng)
class ContactIndex(AlgoliaIndex):
fields = ('name',)
geo_field = 'location'
algoliasearch.register(Contact, ContactIndex)
Did you find this page helpful?