Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

routes.py: Create a new route /delete similar to /population. delete create a DeleteForm object, and on a button click, it checks whether the city name

routes.py: Create a new route /delete similar to /population. delete create a DeleteForm object, and on a button click, it checks whether the city name input in the form is in the 'cities' dictonary. If it is, it deletes it from cities. The route should then redirect to the view route. The render_template sends delete.html as a argument. Remember to import DeleteForm at the top of routes.py.

Here is what I have so far. Need help on the deletion part

image text in transcribed

Die app nport app From flask sort render_template redirect url_for From app forms Population Form From app forms import Delete Form from app import cities form Sapp route '/population methods 'GET' 'POST' def population Population Form SF form validate_on_submit cities form city data form population data form city data form population data return redirect url_for 'population' return render_template 'population.html' form form II II app route "/view_all' def view zeturn render_template 'view_cities.html' cities cities form app route '/delete! methods 'GET' "POST" def delete DeleteForm form validate on submit cities form city data form delete data form city data form delete data return redirect url for 'view all' zeturn render_template 'delete.html' form form Die app nport app From flask sort render_template redirect url_for From app forms Population Form From app forms import Delete Form from app import cities form Sapp route '/population methods 'GET' 'POST' def population Population Form SF form validate_on_submit cities form city data form population data form city data form population data return redirect url_for 'population' return render_template 'population.html' form form II II app route "/view_all' def view zeturn render_template 'view_cities.html' cities cities form app route '/delete! methods 'GET' "POST" def delete DeleteForm form validate on submit cities form city data form delete data form city data form delete data return redirect url for 'view all' zeturn render_template 'delete.html' form form

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Understand how customers respond to effective service recovery.

Answered: 1 week ago