Exemplo n.º 1
0
 def _location_choices(self, search):
     ngram_index = NGram(key=self._location_to_name)
     ngram_index.update(Ward.objects.all())
     ngram_index.update(District.objects.all())
     locations = ngram_index.search(search)[:self.num_choices]
     return [self._location_to_choice(l) for l, _score in locations]