From the course: Advanced Python: Practical Database Examples
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Develop add functionality to add a task - Python Tutorial
From the course: Advanced Python: Practical Database Examples
Develop add functionality to add a task
- [Instructor] Let's create some more functionality that lets the user add tasks to their project. We've already written the routes, so now we just need to read in the data from the request and feed it into the database. In our project-tasks.html, we named the user's input task name, so that's how we'll access it in the request form in our app.py. We'll want to add some error checking here just like we did with add_project. We'll make sure the user enters a task name. If the user entered a description, we'll create a new task and add it to the database. Since the URL contains the project_id, we can use it to create the task. We'll just pass it in. After saving the data or lack thereof if the description was empty, we'll want to redirect to the individual project page. This means we'll redirect to show tasks and we'll feed in our project id. Of course, we aren't done yet. We still need to modify the project-tasks.html…
Contents
-
-
-
-
-
Set up Flask in a Python application2m 20s
-
(Locked)
Create a webpage with Flask2m 52s
-
(Locked)
Build a landing page3m 7s
-
(Locked)
Develop additional routes to enhance your application4m 56s
-
(Locked)
Build a project tasks page2m 16s
-
(Locked)
Create a Postgres database2m 1s
-
(Locked)
Instantiate a Postgres table using Python3m 43s
-
(Locked)
Connect a database to a Python Flask project1m 52s
-
(Locked)
Integrate project data from a Database into Flask2m 57s
-
(Locked)
Integrate task data from a database into a Flask app3m 9s
-
(Locked)
Develop add functionality to add a project5m 7s
-
(Locked)
Develop add functionality to add a task2m 10s
-
(Locked)
Challenge: Develop delete functionality1m
-
(Locked)
Solution: Develop delete functionality7m 13s
-
-