Load the file and initialize the list appropriate
Week 11 Web Development with Flask (1/2)
Overview
2. Think about the problem for a while, and even try writing or drawing a solution using pencil and paper or a whiteboard.
Background
python todoapp.py
The server should then be accessible from a web browser via the URL . The following instructions will describe how the application should work.
@app.route('/')
def hello_world():
Part II First Controller: View List of To Do Items
Our first controller that we are going to create is the controller responsible for showing the current list of To Do items. This controller should be accessible from the ‘/’ route. For this part, you are going to have to create a list that will store these To Do items. This is similar to the email list in the Flask Tutorial from this week’s reading.
● a textbox input used to capture the task itself, with a name of ‘task’
● another textbox input used to capture the task’s email, with a name of ‘email’
● a drop down box allowing the user to choose from ‘Low’, ‘Medium’ or ‘High’ difficulty, with a name of ‘priority’
● a submit button with the label ‘Add To Do Item’Remember, this form needs to submit this data to the ‘/submit’ controller, which we will build next. Until we build it, the form will not work. For this part, just focus on creating the form itself.
At this point, you should now be able to type in a new To Do item, hit the submit button and see the new To Do item rendered in the HTML table.
Part V Third Controller: Clear the List
It would be great if our application was able to delete individual items. Update the main HTML template to render each To Do item with a button that is labelled ‘Delete’. Clicking this button should invoke a controller that will delete that To Do item from the list. There is a difficulties with doing this, however: How can we tell the controller which To Do item we need to delete? Think about how you can change the application to support this.