def search_results(): search_country = [] search_city = [] search_sight = [] search_key = request.form['search'] key = search_key.lower() countries = country_repository.select_all() cities = city_repository.select_all() sights = sight_repository.select_all() for country in countries: if country.name.lower() == key: search_country.append(country) for city in cities: if city.name.lower() == key: search_city.append(city) elif city.country.name.lower() == key: search_city.append(city) for sight in sights: if sight.name.lower() == key: search_sight.append(sight) elif sight.city.name.lower() == key: search_sight.append(sight) elif sight.city.country.name.lower() == key: search_sight.append(sight) return render_template("search.html", countries=countries, cities=cities, sights=sights, search_sight=search_sight, search_city=search_city, search_country=search_country)
def cities(): cities = city_repository.select_all() return render_template( "cities/index.html", cities=cities, title= 'Wherever you go becomes a part of you, where have your travels taken you?' )
def not_visited_cities(): not_visited_cities = [] cities = city_repository.select_all() for city in cities: if city.visited == False: not_visited_cities.append(city) return render_template("cities/not-visited.html", not_visited_cities=not_visited_cities)
def visited_cities(): visited_cities = [] cities = city_repository.select_all() for city in cities: if city.visited == True: visited_cities.append(city) return render_template("cities/visited.html", visited_cities=visited_cities)
def search(): continents = continent_repository.select_all() countries = country_repository.select_all() cities = city_repository.select_all() sights = sight_repository.select_all return render_template("search.html", continents=continents, countries=countries, cities=cities, sights=sights)
def new_trip(): cities = city_repository.select_all() countries = country_repository.select_all() sights = sight_repository.select_all() trips = visit_repository.select_all() return render_template("trips/new.html", cities=cities, countries=countries, sights=sights, trips=trips)
def bucketlist(): bucketlist_cities = [ city for city in city_repository.select_all() if city.visited is False ] countries = country_repository.select_all() bucketlist_countries = [] for country in countries: if country.visited is False: bucketlist_countries.append(country) # import pdb; pdb.set_trace() return render_template("/bucketlist.html", all_cities=bucketlist_cities, all_countries=bucketlist_countries)
def edit_country(id): country = country_repository.select(id) cities = city_repository.select_all() return render_template("countries/edit.html", country=country, all_cities=cities)
def cities(): cities = city_repository.select_all() return render_template("cities/index.html", all_cities = cities)
def new_city(): cities = city_repository.select_all() countries = country_repository.select_all() return render_template("cities/new.html", all_cities = cities, all_countries = countries)
def countries(): countries = country_repository.select_all() cities = city_repository.select_all() return render_template("countries/index.html", all_countries=countries, cities=cities)
def new_sight(id): sel_city = city_repository.select(id) cities = city_repository.select_all() return render_template("sights/new.html", sel_city=sel_city, cities=cities)
def edit_attraction(id): attraction = attraction_repository.select(id) cities = city_repository.select_all() return render_template("attractions/edit.html", attraction=attraction, cities=cities)
def new_attraction(): attractions = attraction_repository.select_all() cities = city_repository.select_all() return render_template("attractions/new.html", attractions=attractions, cities=cities)
def new_item(country_id): cities = city_repository.select_all() country = country_repository.select(country_id) return render_template("/bucketlist/new.html", country = country, cities = cities)