From the course: Full Stack Web Development with Flask
Unlock this course with a free trial
Join today to access over 24,400 courses taught by industry experts.
Passing data to the view - Flask Tutorial
From the course: Full Stack Web Development with Flask
Passing data to the view
- [Instructor] Passing data to the view. In this video, we're going to look at how data can be passed from the source to the view, and we'll also highlight the active menu when a menu item is clicked. Also, we'll be using the For directive to loop through a dictionary of items, and using the For directive, we'll be building the courses table with some JSON data. So let's go see how this is done. Here in the sources files on the desktop, if you open this now, I added another folder called a models folder. Inside here is a courses.json file, just a text file, if you open this using Notepad or a text editor, we can go ahead and copy this first. And again, just a long string of data, as you can see. So I'm going to go ahead and copy, do a Control + A, copy all of it, you can close this now, and then go into the code. So inside Visual Studio Code here, I'm going to go open the templates folder, inside the routes.py and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Creating the base template8m 28s
-
(Locked)
Creating child templates6m 54s
-
(Locked)
Passing data to the view10m 27s
-
(Locked)
Accessing data via request and response objects1m 37s
-
(Locked)
URL variables6m 34s
-
(Locked)
Working with the GET method9m 46s
-
(Locked)
Working with the POST method3m 2s
-
(Locked)
Sending a JSON response8m 1s
-
-
-
-