def create_location(): location = Location( request.form['room_name'], request.form['capacity'] ) location_repository.save(location) return redirect('/locations')
def locations_add(): new_location = Location( request.form['name'], request.form['description'], request.form['visited'], country_repository.select(request.form['country_id'])) location_repository.save(new_location) return redirect('/locations/view')
def submit_new_vu(id): country = country_repository.select(id) location = Location(request.form['location_name'], country) location_repository.save(location) name = request.form['vu_name'] rating = request.form['rating'] description = request.form['description'] visited = request.form['visited'] vu_point = Vu_point(name, location, country, rating, description, visited) vu_point_repository.save(vu_point) # can't use angle brackets here, so must use string interpolation return redirect("/countries-" + id)
import repositories.cast_repository as cast_repository cast_repository.delete_all() spell_repository.delete_all() wizard_repository.delete_all() location_repository.delete_all() wizard1 = Wizard("Gandalferoo", "DePurple", 2000) wizard_repository.save(wizard1) wizard2 = Wizard("Merlin", "McSpells", 1500) wizard_repository.save(wizard2) wizard3 = Wizard("Captain", "Magicpants", 200) wizard_repository.save(wizard3) location1 = Location("Asda", "Supermarket", "Mordor") location_repository.save(location1) location2 = Location("Arthur's Seat", "Natural Wonder", "Edinburgh") location_repository.save(location2) spell1 = Spell("Ripe Old Mage", "Age Acceleration", wizard1) spell_repository.save(spell1) spell2 = Spell("Spell The Beans", "Relentless Honesty", wizard2) spell_repository.save(spell2) spell3 = Spell("Wiccapedia", "Downloads entire Wikipedia server to brain, explosion.", wizard2) spell_repository.save(spell3) cast1 = Cast(5,"5 People Aged Beyond Saving", wizard2, spell1, location1) cast_repository.save(cast1) locations = location_repository.select_all() wizards = wizard_repository.select_all()
country_repository.save(country34) country35 = Country("Namibia", False) country_repository.save(country35) country36 = Country("New Zealand", False) country_repository.save(country36) country37 = Country("Philippines", False) country_repository.save(country37) country38 = Country("Peru", False) country_repository.save(country38) location_1 = Location("McMahon's Point, North Sydney", country1) location_repository.save(location_1) location_2 = Location("Blue Mountains", country1) location_repository.save(location_2) location_3 = Location("Alice Springs, Uluru", country1) location_repository.save(location_3) location_4 = Location("Guatape, Antioquia", country30) location_repository.save(location_4) vu_point_1 = Vu_point( "Sydney Harbour Bridge", location_1, country1, 8, "Lesser known spot to take in the bridge in all its glory.", True) vu_point_repository.save(vu_point_1)
scotland) godafoss = Location("Godafoss", "The most amazing waterfall i have ever seen", True, iceland) lava_field = Location( "Lava field", "Size fo this fields shows an impact of a vulcanic erruption.", True, iceland) clark_quay = Location("Clark Quay", "Good to stay", True, singapore) marina_sands_bay = Location("Marina Sands Bay", "Nice night photography", True, singapore) marina_bay_gardens = Location( "Marina Bay Gardens", "Incredible garens with stunning artificial trees", True, singapore) devils_pulpit = Location("Devils Pulpit", "Awesome colours", True, scotland) location_repository.save(glencoe) location_repository.save(glenfinnan) location_repository.save(godafoss) location_repository.save(lava_field) location_repository.save(clark_quay) location_repository.save(marina_sands_bay) location_repository.save(marina_bay_gardens) location_repository.save(devils_pulpit) # populates locations table with to be visited places bluelagoon = Location("Blue Lagoon", "Amazing thermal pools", False, iceland) sentosa = Location("Sentosa", "Some entertainment there", False, singapore) alps = Location("Alps", "Excellent glacier photo oportunity", False, austria) namibia_dunes = Location("Namibia Dunes", "Excellent dunes photo oportunity", False, namibia)