def _get_cities_by_prefix(self, prefix): for city in City.find_prefix('name', prefix): country_code = city.relation_set.country.code.lower() yield {"name": city.name, "slug": city.slug, "country_code": country_code, "label": self._get_html_label(city.name, country_code), "ranking": city.total_ranking}
def _get_cities_by_prefix(self, prefix): for city in City.find_prefix('name', prefix): country_code = city.relation_set.country.code.lower() yield { "name": city.name, "slug": city.slug, "country_code": country_code, "label": self._get_html_label(city.name, country_code), "ranking": city.total_ranking }
from triplander.models import City city = City.find_one({"slug": "groningen"}) point = city.coordinates distance = 20 City.set_lang("en") for c in City.find_nearby("coordinates", point, distance): print "1", c.name for c in City.find_prefix("name", "gro"): print "2", c.name