Skip to main content
Use the geo_field attribute to add coordinates your record. It should be a callable that returns a tuple (latitude, longitude).
Python
class Contact(models.model):
    name = models.CharField(max_lenght=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)
I