Esempio n. 1
0
def update_country(id):
    name = request.form["name"]
    continent = request.form["continent"]

    country = Country(name, continent, id)
    country_repository.update(country)
    return redirect(f"/countries/{id}")
Esempio n. 2
0
def update_country(id):
    name = request.form["name"]
    continent = request.form["continent"]
    country_visited = country_repository.select(id)
    country = Country(name, continent, country_visited.visited, id)
    country_repository.update(country)
    return redirect("/countries")
def update_country(id):
    name = request.form['name']
    continent_id = request.form['continent_id']
    continent = continent_repository.select(continent_id)
    country = country_repository.select(id)
    visited = country.visited
    updated_country = Country(name, continent, visited, id)
    country_repository.update(updated_country)
    country_id = country.id
    return redirect(f"/countries/{country_id}")
Esempio n. 4
0
def update_country(id):
    country_name = request.form['country_name']
    country_population = request.form['country_population']
    country_visited = False
    print(request.form)
    if 'visited' in request.form:
        country_visited = True
        print(request.form)
    country = Country(country_name, country_population, country_visited, id)
    country_repository.update(country)
    return redirect("/countries")
Esempio n. 5
0
def view_country(id):
    country = country_repository.select(id)
    all_vu_points = country_repository.vu_points(country)

    for vu_point in all_vu_points:  # by doing on this route, it takes account of edits and new vu's
        if vu_point.visited == True:
            country = Country(country.name, True, id)
            country_repository.update(country)

    return render_template("countries/view.html",
                           country=country,
                           all_vu_points=all_vu_points)
Esempio n. 6
0
def visit(id):
    city = city_repository.select(id)
    city_id = city.id
    name = city.name
    country = city.country
    comment = city.comment
    visited = True
    visit_city = City(name, country, visited, comment, id)
    city_repository.update(visit_city)
    visit_city.country.visited = True
    country_repository.update(visit_city.country)
    return redirect(f"/cities/{city_id}")
Esempio n. 7
0
def update_country(id):
    print(request.form)
    name = request.form["name"]
    population = request.form["population"]
    language_spoken = request.form["language_spoken"]
    currency_used = request.form["currency"]
    average_temperature = request.form["temperature"]
    visited = request.form["visited"]
    country = Country(name, population, language_spoken, currency_used,
                      average_temperature, id, visited)
    print(vars(country))
    country_repository.update(country)
    return redirect("/bucketlist")
Esempio n. 8
0
def visit(id):
    sight = sight_repository.select(id)
    sight_id = sight.id
    name = sight.name
    city = sight.city
    comment = sight.comment
    visited = True
    visit_sight = Sight(name, city, visited, comment, id)
    sight_repository.update(visit_sight)
    visit_sight.city.visited = True
    city_repository.update(visit_sight.city)
    visit_sight.city.country.visited = True
    country_repository.update(visit_sight.city.country)
    return redirect(f"/sights/{sight_id}")
Esempio n. 9
0
# test country is saved to database and test return single country
test_country_4 = country_repository.select(country_4.id)
print(test_country_4.name)

#test place saved to database and test return single place and test it has country associated with it
test_place_3 = place_repository.select(place_4.id)
print(test_place_3.description)
country_test = country_repository.select(test_place_3.country.id)
print(country_test.name)

# test updating country
print(country_3.name)
country_5 = Country("Madagascar", country_3.continent, country_3.visited,
                    country_3.id)
country_repository.update(country_5)
test_country_4 = country_repository.select(country_3.id)
print(test_country_4.name)

# and turning it back
print(country_3.name)
country_5 = Country("Ethiopia", country_3.continent, country_3.visited,
                    country_3.id)
country_repository.update(country_5)
test_country_4 = country_repository.select(country_3.id)
print(test_country_4.name)

#test updating place
print(place_2.visited)
place_5 = Place(place_2.place_name, place_2.description, place_2.place_type,
                place_2.country, False, place_2.rating, place_2.id)
def update_country(id):
    country = country_repository.select(id)
    visited = request.form['visited']
    country = Country(country.country_name, visited, id)
    country_repository.update(country)
    return redirect('/countries')
Esempio n. 11
0
def update_country(id):
    name = request.form["name"]
    country = Country(name, id)
    country_repository.update(country)
    return redirect("/countries")
Esempio n. 12
0
def countries_update():
    continent = continent_repository.select(request.form['continent_id'])
    updated_country = Country(request.form['country_name'], continent ,request.form['country_id'])
    country_repository.update(updated_country)
    return redirect('/countries/view')
Esempio n. 13
0
def update_country(id):
    name = request.form['name']
    country = Country(name, id)
    country_repository.update(country)
    return redirect('/list-countries')
def update_country(id):
    name = request.form['country_name']
    continent = request.form['continent']
    country = Country(name, continent)
    country_repository.update(country)
    return redirect('/countries')
Esempio n. 15
0
def submit_country_edit(id):
    country_name = request.form['country']
    visited = request.form['visited']
    country = Country(country_name, visited, id)
    country_repository.update(country)
    return redirect("/countries-" + id)