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)
示例#2
0
def visited_sights():
    visited_sights = []
    sights = sight_repository.select_all()
    for sight in sights:
        if sight.visited == True:
            visited_sights.append(sight)
    return render_template("sights/visited.html", visited_sights=visited_sights)
示例#3
0
def not_visited_sights():
    not_visited_sights = []
    sights = sight_repository.select_all()
    for sight in sights:
        if sight.visited == False:
            not_visited_sights.append(sight)
    return render_template("sights/not-visited.html", not_visited_sights=not_visited_sights)
示例#4
0
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 sights():
    sights = sight_repository.select_all()
    return render_template("sights/index.html", sights=sights)