title
Python Flask Tutorial: Full-Featured Web App Part 8 - Create, Update, and Delete Posts

description
In this Python Flask Tutorial, we will be learning how to add the ability for users to create, update, and delete posts. We will also learn how we can prevent users from updating posts that don't belong to them. Let's get started... The code for this series can be found at: https://github.com/CoreyMSchafer/code_snippets/tree/master/Python/Flask_Blog ✅ Support My Channel Through Patreon: https://www.patreon.com/coreyms ✅ Become a Channel Member: https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join ✅ One-Time Contribution Through PayPal: https://goo.gl/649HFY ✅ Cryptocurrency Donations: Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3 Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33 Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot ✅ Corey's Public Amazon Wishlist http://a.co/inIyro1 ✅ Equipment I Use and Books I Recommend: https://www.amazon.com/shop/coreyschafer ▶️ You Can Find Me On: My Website - http://coreyms.com/ My Second Channel - https://www.youtube.com/c/coreymschafer Facebook - https://www.facebook.com/CoreyMSchafer Twitter - https://twitter.com/CoreyMSchafer Instagram - https://www.instagram.com/coreymschafer/ #Python #Flask

detail
{'title': 'Python Flask Tutorial: Full-Featured Web App Part 8 - Create, Update, and Delete Posts', 'heatmap': [{'end': 406.413, 'start': 346.328, 'weight': 0.71}, {'end': 1418.917, 'start': 1238.464, 'weight': 0.757}, {'end': 2466.27, 'start': 2283.779, 'weight': 0.724}], 'summary': 'Tutorial series on python flask focuses on adding user post functionality, creating new post routes, updating homepage, displaying dates and user images with css classes, and adding update and delete functionality to a basic blogging system, with a detailed explanation of form validation, post creation, updating, and deletion, and integration of user authentication.', 'chapters': [{'end': 465.829, 'segs': [{'end': 38.406, 'src': 'embed', 'start': 0.249, 'weight': 0, 'content': [{'end': 5.951, 'text': "Hey there, how's it going everybody? In this video, we'll be adding the ability for users to add posts that will show up on the homepage.", 'start': 0.249, 'duration': 5.702}, {'end': 9.352, 'text': "So, in this series so far we've been using some dummy data,", 'start': 6.291, 'duration': 3.061}, {'end': 14.154, 'text': "but now we'll actually be able to get rid of that and display actual posts created by the users.", 'start': 9.352, 'duration': 4.802}, {'end': 17.875, 'text': "And we'll also add in the ability to update and delete these posts as well.", 'start': 14.474, 'duration': 3.401}, {'end': 19.576, 'text': "So let's go ahead and get started.", 'start': 18.255, 'duration': 1.321}, {'end': 24.118, 'text': "Okay, so first of all, we're going to need to create a page where users can create a post.", 'start': 19.876, 'duration': 4.242}, {'end': 26.8, 'text': 'And we should be getting used to this process by now.', 'start': 24.539, 'duration': 2.261}, {'end': 30.762, 'text': 'So first we can create a route where a user can write a new post.', 'start': 27.18, 'duration': 3.582}, {'end': 33.183, 'text': "So I'm in my routes file here.", 'start': 31.122, 'duration': 2.061}, {'end': 36.265, 'text': 'And if we go to the bottom, then we can create a new route.', 'start': 33.263, 'duration': 3.002}, {'end': 38.406, 'text': "And now I'll create a route for a new post.", 'start': 36.585, 'duration': 1.821}], 'summary': 'Adding user post creation, update, and deletion functionality to the website.', 'duration': 38.157, 'max_score': 0.249, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U249.jpg'}, {'end': 89.177, 'src': 'embed', 'start': 62.617, 'weight': 2, 'content': [{'end': 66.759, 'text': 'So right underneath here, I can add in that login required decorator.', 'start': 62.617, 'duration': 4.142}, {'end': 70.662, 'text': "And just like the other routes, we're going to want to render a template for this route.", 'start': 67.279, 'duration': 3.383}, {'end': 75.406, 'text': "So I'll render a template that doesn't exist yet, but we'll create it in just a second.", 'start': 71.042, 'duration': 4.364}, {'end': 80.91, 'text': "So I'm going to copy this line here and paste it in to our route.", 'start': 75.706, 'duration': 5.204}, {'end': 83.472, 'text': "And now I'll change this up a little bit for this specific route.", 'start': 81.17, 'duration': 2.302}, {'end': 89.177, 'text': 'So the template that we want to render, I will just call this template create underscore post.', 'start': 83.813, 'duration': 5.364}], 'summary': 'Adding login required decorator and rendering create_post template.', 'duration': 26.56, 'max_score': 62.617, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U62617.jpg'}, {'end': 195.667, 'src': 'embed', 'start': 167.669, 'weight': 3, 'content': [{'end': 170.752, 'text': 'And then the label that we want for this is simply title.', 'start': 167.669, 'duration': 3.083}, {'end': 173.454, 'text': "And now we're also going to want some validators.", 'start': 171.232, 'duration': 2.222}, {'end': 175.096, 'text': 'So we pass in our list of validators.', 'start': 173.474, 'duration': 1.622}, {'end': 176.417, 'text': "But it's only going to be one.", 'start': 175.376, 'duration': 1.041}, {'end': 181.839, 'text': "We're going to pass in a data required validator because every post has to have a title.", 'start': 176.437, 'duration': 5.402}, {'end': 187.923, 'text': 'And the second field is going to be the post content, which will actually be a text area field.', 'start': 182.24, 'duration': 5.683}, {'end': 190.064, 'text': "And we haven't used a text area field yet.", 'start': 188.263, 'duration': 1.801}, {'end': 191.565, 'text': 'So we need to import that.', 'start': 190.344, 'duration': 1.221}, {'end': 195.667, 'text': "So here from the top where we're importing our other fields.", 'start': 191.865, 'duration': 3.802}], 'summary': 'Creating a form with title and post content fields, using validators.', 'duration': 27.998, 'max_score': 167.669, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U167669.jpg'}, {'end': 342.505, 'src': 'embed', 'start': 319.186, 'weight': 4, 'content': [{'end': 330.196, 'text': "and for now let's just add a flash message that their post has been created and then redirect them back to the home page and we'll actually put in the logic for adding this post to the database in just a minute.", 'start': 319.186, 'duration': 11.01}, {'end': 342.505, 'text': "but for now we'll just say a flash message here and we'll say your post has been created with an exclamation point and let's pass in a category of success,", 'start': 330.196, 'duration': 12.309}], 'summary': 'Add a flash message for post creation and redirect to home page.', 'duration': 23.319, 'max_score': 319.186, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U319186.jpg'}, {'end': 406.413, 'src': 'heatmap', 'start': 346.328, 'weight': 0.71, 'content': [{'end': 348.53, 'text': "and now let's redirect them to the home page.", 'start': 346.328, 'duration': 2.202}, {'end': 354.074, 'text': "so we'll say return, redirect and we're going to redirect them to url4 and pass in the home route.", 'start': 348.53, 'duration': 5.544}, {'end': 360.378, 'text': "So now let's actually add this form to our create post template.", 'start': 357.336, 'duration': 3.042}, {'end': 362.779, 'text': 'And this will be similar to our other forms.', 'start': 360.738, 'duration': 2.041}, {'end': 366.301, 'text': "So I'm going to grab a snippet from one of our other routes just to get us started.", 'start': 363.039, 'duration': 3.262}, {'end': 369.943, 'text': "So I'm going to open up the login template here.", 'start': 366.621, 'duration': 3.322}, {'end': 376.415, 'text': "And I'm going to copy our entire div of content section that wraps our form.", 'start': 371.491, 'duration': 4.924}, {'end': 382.299, 'text': "And I'm going to paste this in to our create post route.", 'start': 376.995, 'duration': 5.304}, {'end': 386.922, 'text': "So I'll paste that in and fix these indentations here.", 'start': 382.479, 'duration': 4.443}, {'end': 391.126, 'text': "And now we'll change this around to match the fields that we need in our post form.", 'start': 387.303, 'duration': 3.823}, {'end': 395.088, 'text': 'So first, I will change the legend here.', 'start': 391.546, 'duration': 3.542}, {'end': 396.95, 'text': 'So the legend at the top of our field.', 'start': 395.189, 'duration': 1.761}, {'end': 400.451, 'text': "I'm going to change this to new post.", 'start': 397.33, 'duration': 3.121}, {'end': 406.413, 'text': "And now I'll change these form group divs here to match our current post form.", 'start': 400.731, 'duration': 5.682}], 'summary': 'Adding a form to create post template with required fields and content section.', 'duration': 60.085, 'max_score': 346.328, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U346328.jpg'}], 'start': 0.249, 'title': 'Adding user post functionality', 'summary': 'Discusses adding the ability for users to create, update, and delete posts, replacing dummy data with actual user-generated content. it also outlines the process of creating a route for users to write new posts and details the creation of a new post route requiring user login, a new post template, and the form creation process with title and content fields, including form validation and flash messages for successful post creation.', 'chapters': [{'end': 38.406, 'start': 0.249, 'title': 'Adding user post functionality', 'summary': 'Discusses adding the ability for users to create, update, and delete posts, thereby replacing dummy data with actual user-generated content. it also outlines the process of creating a route for users to write new posts.', 'duration': 38.157, 'highlights': ['The chapter discusses adding the ability for users to create, update, and delete posts The video focuses on enabling users to add, update, and delete posts, replacing dummy data with actual user-generated content.', 'Creating a route for users to write new posts The process of creating a route for users to write new posts is outlined, emphasizing the need to establish a page for users to create posts.']}, {'end': 465.829, 'start': 38.566, 'title': 'Creating new post route and template', 'summary': 'Details the creation of a new post route requiring user login, a new post template, and the form creation process with title and content fields, including the addition of form validation and flash messages for successful post creation.', 'duration': 427.263, 'highlights': ['New post route created requiring user login and rendering a new post template. Creation of a new post route and template requiring user login for posting new posts.', 'Form creation process with title and content fields, and addition of form validation. Process of creating a form with title and content fields and adding form validation for ensuring the presence of title and content in the post.', 'Addition of flash message for successful post creation and redirection to home page. Inclusion of a flash message for successful post creation and redirection to the home page after the post addition process.']}], 'duration': 465.58, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U249.jpg', 'highlights': ['The chapter discusses adding the ability for users to create, update, and delete posts, replacing dummy data with actual user-generated content.', 'Creating a route for users to write new posts is outlined, emphasizing the need to establish a page for users to create posts.', 'Creation of a new post route and template requiring user login for posting new posts.', 'Process of creating a form with title and content fields and adding form validation for ensuring the presence of title and content in the post.', 'Inclusion of a flash message for successful post creation and redirection to the home page after the post addition process.']}, {'end': 937.22, 'segs': [{'end': 495.482, 'src': 'embed', 'start': 466.69, 'weight': 5, 'content': [{'end': 471.633, 'text': "But we don't want this forgot password link here after our submit button.", 'start': 466.69, 'duration': 4.943}, {'end': 473.274, 'text': "So we'll get rid of that as well.", 'start': 471.653, 'duration': 1.621}, {'end': 476.677, 'text': 'So that should be all the changes that we need to make to this post form.', 'start': 473.655, 'duration': 3.022}, {'end': 481.738, 'text': "Now, just a reminder, I know that it can be hard to keep up with small changes like these when you're following along with a video.", 'start': 477.097, 'duration': 4.641}, {'end': 488.44, 'text': 'But if you think that you may have messed something up or just want to grab the completed version of this file from this video,', 'start': 482.278, 'duration': 6.162}, {'end': 491.241, 'text': 'then I do have this code available in the description section below.', 'start': 488.44, 'duration': 2.801}, {'end': 495.482, 'text': 'Okay, so that should do it for this template and for our route and for the form.', 'start': 491.601, 'duration': 3.881}], 'summary': 'Removing the forgot password link and finalizing changes in the post form.', 'duration': 28.792, 'max_score': 466.69, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U466690.jpg'}, {'end': 654.747, 'src': 'embed', 'start': 564.675, 'weight': 0, 'content': [{'end': 572.56, 'text': 'so I will pull up the browser and reload our page and I am currently logged in and we can see that we have this new post route here.', 'start': 564.675, 'duration': 7.885}, {'end': 577.603, 'text': 'so if I go to this new post route, then we can see that we have this new post form now.', 'start': 572.56, 'duration': 5.043}, {'end': 581.925, 'text': "if you weren't logged in, then you'll have to log in first before you can see this new post route.", 'start': 577.603, 'duration': 4.322}, {'end': 587.832, 'text': 'So now, if I hit post on this new post route, then we can see our validation is working.', 'start': 582.766, 'duration': 5.066}, {'end': 589.835, 'text': 'It says that these fields are required.', 'start': 587.852, 'duration': 1.983}, {'end': 593.74, 'text': "And now let's just fill these in with some dummy values.", 'start': 590.416, 'duration': 3.324}, {'end': 598.426, 'text': 'So I will say blog one and then blog one content.', 'start': 594.06, 'duration': 4.366}, {'end': 601.809, 'text': "And now let's post this new post form.", 'start': 598.806, 'duration': 3.003}, {'end': 607.374, 'text': 'And now we can see that we get redirected to our homepage with our alert message here that our post has been created.', 'start': 601.829, 'duration': 5.545}, {'end': 612.339, 'text': 'But our homepage is currently still using our dummy data from the beginning of this series.', 'start': 608.115, 'duration': 4.224}, {'end': 620.746, 'text': "So now let's actually save these posts to our database and display those posts on our homepage and delete this old static dummy data that we've been using.", 'start': 612.719, 'duration': 8.027}, {'end': 622.508, 'text': "So let's go back to our routes.", 'start': 621.127, 'duration': 1.381}, {'end': 624.969, 'text': 'and add these posts to the database.', 'start': 623.008, 'duration': 1.961}, {'end': 631.213, 'text': 'So I will pull back up our application and pull up our routes.py file here.', 'start': 625.109, 'duration': 6.104}, {'end': 633.854, 'text': 'So to actually add this post to our database.', 'start': 631.533, 'duration': 2.321}, {'end': 639.477, 'text': "it's going to be similar to when we added a user to our database, but it's actually going to be easier than that,", 'start': 633.854, 'duration': 5.623}, {'end': 643.079, 'text': "because we don't need to hash passwords or anything like that.", 'start': 639.477, 'duration': 3.602}, {'end': 654.747, 'text': 'So we can simply just say post is equal to post and then we can set our fields equal to what is coming in from our form.', 'start': 643.439, 'duration': 11.308}], 'summary': 'Logged in user posts new content, validates, saves to database, and displays on homepage.', 'duration': 90.072, 'max_score': 564.675, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U564675.jpg'}, {'end': 866.834, 'src': 'embed', 'start': 840.281, 'weight': 4, 'content': [{'end': 843.762, 'text': "so we'll just change this to print out only the year, month and day.", 'start': 840.281, 'duration': 3.481}, {'end': 849.11, 'text': "It's nice having that exact time of the post in the database, but on the front page we'll just display the date.", 'start': 844.142, 'duration': 4.968}, {'end': 851.073, 'text': "So we'll fix those.", 'start': 849.871, 'duration': 1.202}, {'end': 859.265, 'text': "And it will also be nice to display the user's profile picture with their post as well, like you'd see on other popular sites.", 'start': 851.513, 'duration': 7.752}, {'end': 862.589, 'text': 'And I already have styles for that in our CSS.', 'start': 859.745, 'duration': 2.844}, {'end': 865.513, 'text': 'We just need to add the HTML to our template.', 'start': 862.849, 'duration': 2.664}, {'end': 866.834, 'text': "So let's go do that.", 'start': 865.833, 'duration': 1.001}], 'summary': 'Modify post display to show date only and add user profile picture.', 'duration': 26.553, 'max_score': 840.281, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U840281.jpg'}], 'start': 466.69, 'title': 'Adding new post route and updating homepage', 'summary': 'Covers making changes to the post form template, adding a link to the new post route in the navigation bar, validating the form, and updating the homepage to display real posts from the database, including adding, removing, and retrieving posts.', 'chapters': [{'end': 607.374, 'start': 466.69, 'title': 'Adding new post route to navigation', 'summary': 'Covers making changes to the post form template, adding a link to the new post route in the navigation bar, and validating the new post form, resulting in successful redirection to the homepage.', 'duration': 140.684, 'highlights': ['We removed the forgot password link after the submit button on the post form.', 'Added a link to the new post route in the navigation bar for logged-in users for easy access.', 'Validated the new post form, which displayed the required fields message and successfully redirected to the homepage after posting a new entry.']}, {'end': 937.22, 'start': 608.115, 'title': 'Updating homepage with real data', 'summary': 'Details the process of updating the homepage to display real posts from the database instead of dummy data, including adding posts to the database, removing dummy data, retrieving real posts, and adjusting the display of post attributes.', 'duration': 329.105, 'highlights': ["Posts are added to the database using the 'post' model fields obtained from a form, and the author is specified as the current user. Adding posts to the database involves setting post fields from form data and specifying the author, simplifying the process compared to adding a user.", 'The homepage route is modified to retrieve all posts from the database and display them on the homepage. The homepage route is updated to fetch and display real posts from the database instead of the previous static dummy data.', "Adjustments are made to the display of post attributes, including showing only the author's username, formatting the date, and potentially adding the user's profile picture to the post. Changes are made to the display of post attributes, such as showing only the author's username, formatting the date, and potentially adding the user's profile picture to the post."]}], 'duration': 470.53, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U466690.jpg', 'highlights': ['Added a link to the new post route in the navigation bar for logged-in users for easy access.', 'The homepage route is modified to retrieve all posts from the database and display them on the homepage.', 'Validated the new post form, which displayed the required fields message and successfully redirected to the homepage after posting a new entry.', "Posts are added to the database using the 'post' model fields obtained from a form, and the author is specified as the current user.", "Adjustments are made to the display of post attributes, including showing only the author's username, formatting the date, and potentially adding the user's profile picture to the post.", 'We removed the forgot password link after the submit button on the post form.']}, {'end': 1650.489, 'segs': [{'end': 985.072, 'src': 'embed', 'start': 937.56, 'weight': 0, 'content': [{'end': 941.803, 'text': "then you can find different values that you can plug in there to display dates in any format that you'd like.", 'start': 937.56, 'duration': 4.243}, {'end': 951.011, 'text': "Okay, and to display the user's image, I'm going to put in an image tag here with some CSS classes that we added earlier in the series.", 'start': 942.724, 'duration': 8.287}, {'end': 954.513, 'text': "And I'm just going to add this image right to the top of the article.", 'start': 951.331, 'duration': 3.182}, {'end': 959.898, 'text': "So right inside the opening article tag there, I'm going to say image.", 'start': 954.614, 'duration': 5.284}, {'end': 964.321, 'text': 'And this image is going to have a class equal to image.', 'start': 960.438, 'duration': 3.883}, {'end': 972.205, 'text': "And I'll set this equal to rounded-circle, which is a bootstrap class to just round your image.", 'start': 965.522, 'duration': 6.683}, {'end': 980.87, 'text': 'And then I will also set a class here of article-image, which is a custom class that we added in our main.css.', 'start': 972.706, 'duration': 8.164}, {'end': 985.072, 'text': "And that's just going to make sure that has the right sizing and padding and things like that.", 'start': 981.13, 'duration': 3.942}], 'summary': 'Demonstrating date display and image insertion with css classes for styling.', 'duration': 47.512, 'max_score': 937.56, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U937560.jpg'}, {'end': 1144.218, 'src': 'embed', 'start': 1116.338, 'weight': 5, 'content': [{'end': 1125.884, 'text': 'So if we wanted to create a route where the ID of a post is actually part of the route, then we can create a route that looks like this.', 'start': 1116.338, 'duration': 9.546}, {'end': 1129.347, 'text': 'So let me grab a starting point here.', 'start': 1125.945, 'duration': 3.402}, {'end': 1138.393, 'text': 'And we can actually put this variable into the URL itself by putting in these angle brackets and then saying post ID.', 'start': 1130.087, 'duration': 8.306}, {'end': 1144.218, 'text': 'So for example, if the user was to go to post forward slash one, then post ID would be equal to one.', 'start': 1138.674, 'duration': 5.544}], 'summary': 'Creating a route with post id as part of the url.', 'duration': 27.88, 'max_score': 1116.338, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1116338.jpg'}, {'end': 1418.917, 'src': 'heatmap', 'start': 1238.464, 'weight': 0.757, 'content': [{'end': 1244.347, 'text': "So I will say return render template, and this will be, we'll call this post.html.", 'start': 1238.464, 'duration': 5.883}, {'end': 1250.271, 'text': "And for the title of this one, let's just pass in the title of our post.", 'start': 1246.488, 'duration': 3.783}, {'end': 1253.933, 'text': "So I'll say title is equal to post.title.", 'start': 1250.571, 'duration': 3.362}, {'end': 1258.376, 'text': "And now let's pass in that post into our template.", 'start': 1254.634, 'duration': 3.742}, {'end': 1260.378, 'text': "Okay And now let's create a template for this.", 'start': 1258.676, 'duration': 1.702}, {'end': 1266.082, 'text': "So up in my templates here, we'll create a new file and we'll call this post.html.", 'start': 1260.718, 'duration': 5.364}, {'end': 1273.947, 'text': "And then this will be very similar to our home.html, except it's going to be a single post instead of all of our posts.", 'start': 1266.842, 'duration': 7.105}, {'end': 1281.972, 'text': "So I'm going to go to home.html and actually copy all of that and paste it in to our post template.", 'start': 1274.307, 'duration': 7.665}, {'end': 1283.914, 'text': "And we'll use this as our starting point.", 'start': 1282.293, 'duration': 1.621}, {'end': 1289.037, 'text': "But within here, we won't need to loop over the post since there will only be one.", 'start': 1284.254, 'duration': 4.783}, {'end': 1298.644, 'text': 'So we can just get rid of this for loop here and also the ending of that for loop and then fix that indentation.', 'start': 1289.357, 'duration': 9.287}, {'end': 1302.686, 'text': "And also we're not going to need our blog title to be a link anymore.", 'start': 1299.384, 'duration': 3.302}, {'end': 1308.949, 'text': "The only reason it is a link on the homepage is so that they can link to this page that we're creating now.", 'start': 1303.026, 'duration': 5.923}, {'end': 1312.931, 'text': "So we'll just make that an H2 of the post title.", 'start': 1309.329, 'duration': 3.602}, {'end': 1317.174, 'text': "So I'm going to remove the link here surrounding the post title.", 'start': 1312.971, 'duration': 4.203}, {'end': 1321.017, 'text': 'So remove the opening and the closing tags for that anchor tag.', 'start': 1317.354, 'duration': 3.663}, {'end': 1324.64, 'text': 'But I am going to keep that class that it had on that anchor tag.', 'start': 1321.237, 'duration': 3.403}, {'end': 1329.504, 'text': "So I'm going to set the class equal to article-title and save that.", 'start': 1324.88, 'duration': 4.624}, {'end': 1335.169, 'text': 'Okay, and lastly, we need to actually add the links to this route for the individual post on the homepage.', 'start': 1329.844, 'duration': 5.325}, {'end': 1341.374, 'text': 'So if we pull up the template for the homepage right now, if we look at the links for the post title,', 'start': 1335.469, 'duration': 5.905}, {'end': 1347.72, 'text': "then we can see that we're just using this pound sign for the link location, which means that the link doesn't actually go anywhere.", 'start': 1341.374, 'duration': 6.346}, {'end': 1351.583, 'text': 'But we want this to go to the page for that individual post.', 'start': 1348.08, 'duration': 3.503}, {'end': 1356.964, 'text': 'So which would be the post route that we just created with the ID of the post.', 'start': 1352.003, 'duration': 4.961}, {'end': 1363.105, 'text': 'So to do that, we can add in our double curly braces like we are used to.', 'start': 1357.284, 'duration': 5.821}, {'end': 1369.867, 'text': 'And then we can say URL for and this is going to be a URL for and we called this route.', 'start': 1363.486, 'duration': 6.381}, {'end': 1371.527, 'text': 'We called that route post.', 'start': 1370.307, 'duration': 1.22}, {'end': 1374.288, 'text': 'So this will be a URL for post.', 'start': 1371.967, 'duration': 2.321}, {'end': 1379.15, 'text': 'And now we also need to post in that post ID with that route.', 'start': 1374.788, 'duration': 4.362}, {'end': 1386.894, 'text': 'So we can say that the post ID for that route is going to be equal to our post dot ID.', 'start': 1379.491, 'duration': 7.403}, {'end': 1391.196, 'text': "So, as we're looping through all of our posts on our homepage, once it gets to this point,", 'start': 1387.214, 'duration': 3.982}, {'end': 1397.76, 'text': "it's going to print out the post title and that is going to be an anchor tag and the location for that anchor tag.", 'start': 1391.196, 'duration': 6.564}, {'end': 1406.887, 'text': "is going to be the URL for that post and we're going to set this post ID equal to the current post dot ID.", 'start': 1398.38, 'duration': 8.507}, {'end': 1410.33, 'text': "so let's save this and actually see what this looks like on the website.", 'start': 1406.887, 'duration': 3.443}, {'end': 1412.852, 'text': "so I've got all of my files saved here.", 'start': 1410.33, 'duration': 2.522}, {'end': 1417.676, 'text': "let's open back up our web server and we need to restart this.", 'start': 1412.852, 'duration': 4.824}, {'end': 1418.917, 'text': 'so I will run that.', 'start': 1417.676, 'duration': 1.241}], 'summary': 'Creating a post template and setting up links for individual posts.', 'duration': 180.453, 'max_score': 1238.464, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1238464.jpg'}, {'end': 1559.641, 'src': 'embed', 'start': 1530.852, 'weight': 3, 'content': [{'end': 1538.296, 'text': "okay, so now we're able to add posts and see them on our home page, but let's also add the ability to update and delete posts.", 'start': 1530.852, 'duration': 7.444}, {'end': 1543.117, 'text': "so let's create a new route that displays a form to update a post.", 'start': 1538.636, 'duration': 4.481}, {'end': 1550.699, 'text': "so let's go back to our home page here and now, let's bring back up our application and go to our routes.", 'start': 1543.117, 'duration': 7.582}, {'end': 1552.559, 'text': "and now i'm going to create a new route here.", 'start': 1550.699, 'duration': 1.86}, {'end': 1559.641, 'text': "that is the post id, followed by a forward slash update, and it's going to be similar to the one that we just created.", 'start': 1552.559, 'duration': 7.082}], 'summary': 'Adding functionality to update and delete posts.', 'duration': 28.789, 'max_score': 1530.852, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1530852.jpg'}, {'end': 1599.737, 'src': 'embed', 'start': 1576.026, 'weight': 4, 'content': [{'end': 1583.588, 'text': "So I will call this update underscore post, and this is going to be a route that requires a login, because if you're trying to update a post,", 'start': 1576.026, 'duration': 7.562}, {'end': 1585.529, 'text': 'then it means that you have to log in first.', 'start': 1583.588, 'duration': 1.941}, {'end': 1589.95, 'text': "So let's put in that login required decorator there.", 'start': 1585.889, 'duration': 4.061}, {'end': 1594.033, 'text': "And now let's do the same thing that we did for our specific post page.", 'start': 1590.41, 'duration': 3.623}, {'end': 1599.737, 'text': "We will get a post with that ID and if it doesn't exist then we will return a 404.", 'start': 1594.413, 'duration': 5.324}], 'summary': "Creating an 'update_post' route that requires login and handles post retrieval with error handling.", 'duration': 23.711, 'max_score': 1576.026, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1576026.jpg'}], 'start': 937.56, 'title': 'Displaying dates and user images with css classes and adding functionality to a basic blogging system', 'summary': "Covers displaying dates in different formats and adding user images using css classes such as 'rounded-circle' and 'article-image', and explains how to add functionality to a basic blogging system with multiple users, including displaying individual posts, creating routes for updating and deleting posts, and implementing user authentication.", 'chapters': [{'end': 985.072, 'start': 937.56, 'title': 'Displaying dates and user images with css classes', 'summary': "Covers displaying dates in different formats and adding user images using css classes such as 'rounded-circle' and 'article-image'.", 'duration': 47.512, 'highlights': ['Displaying dates in different formats by plugging in values.', "Adding user images with CSS classes like 'rounded-circle' and 'article-image'.", 'Using CSS classes to ensure the right sizing and padding for the article image.']}, {'end': 1650.489, 'start': 985.472, 'title': 'Adding functionality to a basic blogging system', 'summary': 'Explains how to add functionality to a basic blogging system with multiple users, including displaying individual posts, creating routes for updating and deleting posts, and implementing user authentication.', 'duration': 665.017, 'highlights': ['Displaying Individual Posts The chapter explains how to create a route to display a specific post, using the post ID as part of the route, fetching the post if it exists, and rendering a template to return the post.', 'Creating Routes for Updating and Deleting Posts The chapter demonstrates the creation of a route to display a form for updating a post, including the requirement for user login and the check to ensure that only the author of the post can update it.', 'Implementing User Authentication The chapter discusses the importance of user authentication in allowing users to update or delete their own posts, including the use of decorators and error responses to manage access control.']}], 'duration': 712.929, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U937560.jpg', 'highlights': ['Using CSS classes to ensure the right sizing and padding for the article image.', "Adding user images with CSS classes like 'rounded-circle' and 'article-image'.", 'Displaying dates in different formats by plugging in values.', 'Creating Routes for Updating and Deleting Posts The chapter demonstrates the creation of a route to display a form for updating a post, including the requirement for user login and the check to ensure that only the author of the post can update it.', 'Implementing User Authentication The chapter discusses the importance of user authentication in allowing users to update or delete their own posts, including the use of decorators and error responses to manage access control.', 'Displaying Individual Posts The chapter explains how to create a route to display a specific post, using the post ID as part of the route, fetching the post if it exists, and rendering a template to return the post.']}, {'end': 1975.839, 'segs': [{'end': 1725.38, 'src': 'embed', 'start': 1674.279, 'weight': 2, 'content': [{'end': 1680.004, 'text': 'And the template will pretty much be the same as our current post template with just one small difference.', 'start': 1674.279, 'duration': 5.725}, {'end': 1683.728, 'text': "So for now, let's render that template and see what it looks like.", 'start': 1680.305, 'duration': 3.423}, {'end': 1687.451, 'text': 'So I will actually just grab it from here.', 'start': 1684.048, 'duration': 3.403}, {'end': 1690.334, 'text': 'So I will open that is our post template.', 'start': 1687.832, 'duration': 2.502}, {'end': 1693.397, 'text': 'I want to grab our create post template here.', 'start': 1690.434, 'duration': 2.963}, {'end': 1694.598, 'text': 'So I will copy that.', 'start': 1693.577, 'duration': 1.021}, {'end': 1698.9, 'text': 'and paste that in here in our update post route.', 'start': 1695.218, 'duration': 3.682}, {'end': 1704.423, 'text': 'Instead of a new post as being the title, I will make that update post as being the title.', 'start': 1699.28, 'duration': 5.143}, {'end': 1708.145, 'text': "So let's open this in our browser and see what this looks like right now.", 'start': 1704.703, 'duration': 3.442}, {'end': 1713.928, 'text': "So I've got everything saved and in my terminal, I'm going to restart our development server.", 'start': 1708.465, 'duration': 5.463}, {'end': 1717.611, 'text': 'and then reload our browser here.', 'start': 1714.768, 'duration': 2.843}, {'end': 1725.38, 'text': 'So first, let me log out as our test user and log back in as the Corey M.', 'start': 1718.392, 'duration': 6.988}], 'summary': "Updating post template to 'update post' title in route.", 'duration': 51.101, 'max_score': 1674.279, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1674279.jpg'}, {'end': 1794.581, 'src': 'embed', 'start': 1769.427, 'weight': 3, 'content': [{'end': 1776.151, 'text': "So first we want the title and content to be populated with the content of the existing post that we're updating.", 'start': 1769.427, 'duration': 6.724}, {'end': 1781.174, 'text': 'And also I want the form legend to say update post instead of new post.', 'start': 1776.631, 'duration': 4.543}, {'end': 1784.716, 'text': "So to change this, let's go back to our routes.", 'start': 1781.554, 'duration': 3.162}, {'end': 1790.319, 'text': "So first of all, I'm not going to create an entirely separate template just to update the legend of that form.", 'start': 1785.056, 'duration': 5.263}, {'end': 1794.581, 'text': "I'm just going to create a legend value that we pass into each template.", 'start': 1790.619, 'duration': 3.962}], 'summary': 'Updating post content and form legend for routes.', 'duration': 25.154, 'max_score': 1769.427, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1769427.jpg'}, {'end': 1900.952, 'src': 'embed', 'start': 1852.685, 'weight': 0, 'content': [{'end': 1859.149, 'text': 'Okay, and we also wanted the form to be populated with the current post title and content on our update page.', 'start': 1852.685, 'duration': 6.464}, {'end': 1862.772, 'text': "Now we've seen this before in our account page with our account info.", 'start': 1859.469, 'duration': 3.303}, {'end': 1865.033, 'text': "so it's going to be similar.", 'start': 1863.632, 'duration': 1.401}, {'end': 1871.336, 'text': 'so if I go back here to our update route, then right under where we are initializing this form,', 'start': 1865.033, 'duration': 6.303}, {'end': 1882.701, 'text': 'we can simply say that the form.title.data is going to be equal to the post.title and we can do the same thing for the content.', 'start': 1871.336, 'duration': 11.365}, {'end': 1886.523, 'text': "so we'll say form.content.data.", 'start': 1882.701, 'duration': 3.822}, {'end': 1889.044, 'text': 'set that equal to the post content.', 'start': 1886.523, 'duration': 2.521}, {'end': 1895.328, 'text': 'okay, so those changes should handle changing the legend and filling in the form with the current post data.', 'start': 1889.384, 'duration': 5.944}, {'end': 1900.952, 'text': "so now let's also add in the logic to update the post if the form validates.", 'start': 1895.328, 'duration': 5.624}], 'summary': 'Update page form needs to populate with current post title and content. logic to update post if form validates.', 'duration': 48.267, 'max_score': 1852.685, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1852685.jpg'}], 'start': 1650.65, 'title': 'Updating post form and logic', 'summary': 'Covers updating the post form and template, reusing the previous post form, making changes to the template, and the process of updating a post in a web application using routes, form population, and form validation, with a goal of updating the post content and legend, and committing the changes to the database.', 'chapters': [{'end': 1725.38, 'start': 1650.65, 'title': 'Updating post form and template', 'summary': 'Covers updating the post form and template, reusing the previous post form, and making changes to the template, with the author demonstrating the process step by step.', 'duration': 74.73, 'highlights': ['The form used for updating the post is the same as the previous post form, demonstrating reusability.', 'The template for updating the post is almost the same as the current post template, with minor differences.', "The author changes the title from 'new post' to 'update post' in the post template.", 'The author restarts the development server and reloads the browser to view the changes.']}, {'end': 1975.839, 'start': 1725.38, 'title': 'Updating post logic', 'summary': 'Covers the process of updating a post in a web application using routes, form population, and form validation, with the goal of updating the post content and legend, and committing the changes to the database.', 'duration': 250.459, 'highlights': ['The form needs to be populated with the content of the existing post being updated, achieved by setting form.title.data and form.content.data equal to the post title and content, respectively.', "The form legend is updated to 'Update Post' instead of 'New Post' by passing a legend value into each template and displaying it within the create post template.", 'Logic for updating the post involves handling the form validation, updating the post title and content if the form is valid, and committing the changes to the database using db.session.commit.']}], 'duration': 325.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1650650.jpg', 'highlights': ['The form used for updating the post is the same as the previous post form, demonstrating reusability.', 'The form needs to be populated with the content of the existing post being updated, achieved by setting form.title.data and form.content.data equal to the post title and content, respectively.', 'The template for updating the post is almost the same as the current post template, with minor differences.', "The author changes the title from 'new post' to 'update post' in the post template.", "The form legend is updated to 'Update Post' instead of 'New Post' by passing a legend value into each template and displaying it within the create post template.", 'Logic for updating the post involves handling the form validation, updating the post title and content if the form is valid, and committing the changes to the database using db.session.commit.', 'The author restarts the development server and reloads the browser to view the changes.']}, {'end': 2880.295, 'segs': [{'end': 2010.784, 'src': 'embed', 'start': 1976.179, 'weight': 1, 'content': [{'end': 1984.004, 'text': 'So we can flash a message that says your post has been updated and then we can pass in our style.', 'start': 1976.179, 'duration': 7.825}, {'end': 1986.045, 'text': "And for this, we'll do a success style.", 'start': 1984.204, 'duration': 1.841}, {'end': 1994.071, 'text': 'And then we can redirect back to that post route for that specific post.', 'start': 1986.725, 'duration': 7.346}, {'end': 1995.492, 'text': 'So I will say return.', 'start': 1994.411, 'duration': 1.081}, {'end': 1998.234, 'text': 'And that will be a redirect.', 'start': 1996.073, 'duration': 2.161}, {'end': 2004.779, 'text': 'And that will be a redirect for URL 4 and the URL for our post route.', 'start': 1998.675, 'duration': 6.104}, {'end': 2010.784, 'text': 'And we want this to be the post ID of our current post.', 'start': 2005.34, 'duration': 5.444}], 'summary': 'Flash success message and redirect to updated post route.', 'duration': 34.605, 'max_score': 1976.179, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1976179.jpg'}, {'end': 2319.522, 'src': 'embed', 'start': 2294.022, 'weight': 2, 'content': [{'end': 2299.567, 'text': 'Now, when it comes to deleting their post, I want the user to confirm that they actually want to delete that post.', 'start': 2294.022, 'duration': 5.545}, {'end': 2301.708, 'text': "So I'm going to use a Bootstrap modal.", 'start': 2299.827, 'duration': 1.881}, {'end': 2304.711, 'text': "Now that's why I used a button instead of a link.", 'start': 2302.069, 'duration': 2.642}, {'end': 2310.816, 'text': "And I'm actually going to grab this directly from the Bootstrap website so that I don't mistype anything.", 'start': 2305.111, 'duration': 5.705}, {'end': 2315.96, 'text': 'So if you were to search Bootstrap modal, then you will be able to find this page too.', 'start': 2311.136, 'duration': 4.824}, {'end': 2319.522, 'text': "So I'm going to go to my browser and open up this modal page.", 'start': 2316, 'duration': 3.522}], 'summary': 'Implementing post deletion confirmation using bootstrap modal.', 'duration': 25.5, 'max_score': 2294.022, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U2294022.jpg'}, {'end': 2468.611, 'src': 'heatmap', 'start': 2283.779, 'weight': 0, 'content': [{'end': 2292.862, 'text': "i want that to be small as well, so btn-sm, and we'll give that the same margin m-1, and we want this button to say delete.", 'start': 2283.779, 'duration': 9.083}, {'end': 2299.567, 'text': 'Now, when it comes to deleting their post, I want the user to confirm that they actually want to delete that post.', 'start': 2294.022, 'duration': 5.545}, {'end': 2301.708, 'text': "So I'm going to use a Bootstrap modal.", 'start': 2299.827, 'duration': 1.881}, {'end': 2304.711, 'text': "Now that's why I used a button instead of a link.", 'start': 2302.069, 'duration': 2.642}, {'end': 2310.816, 'text': "And I'm actually going to grab this directly from the Bootstrap website so that I don't mistype anything.", 'start': 2305.111, 'duration': 5.705}, {'end': 2315.96, 'text': 'So if you were to search Bootstrap modal, then you will be able to find this page too.', 'start': 2311.136, 'duration': 4.824}, {'end': 2319.522, 'text': "So I'm going to go to my browser and open up this modal page.", 'start': 2316, 'duration': 3.522}, {'end': 2322.505, 'text': 'And within here you want to go to their live demo section.', 'start': 2319.863, 'duration': 2.642}, {'end': 2328.932, 'text': "And I'm just going to copy the data toggle and data target part of their button.", 'start': 2322.985, 'duration': 5.947}, {'end': 2331.434, 'text': 'This is what actually toggles the modal.', 'start': 2329.112, 'duration': 2.322}, {'end': 2339.663, 'text': 'So I will copy that and then I will paste this in to my button on my page here.', 'start': 2331.734, 'duration': 7.929}, {'end': 2342.864, 'text': 'So I will add that in.', 'start': 2340.163, 'duration': 2.701}, {'end': 2349.467, 'text': "Now instead of this data target pointing to example modal, let's actually change this to delete modal.", 'start': 2343.184, 'duration': 6.283}, {'end': 2352.529, 'text': "So now let's go back to their website.", 'start': 2349.827, 'duration': 2.702}, {'end': 2357.931, 'text': 'And now I can actually grab all of the code for this modal and paste it into the end of my content section.', 'start': 2352.709, 'duration': 5.222}, {'end': 2361.954, 'text': "Now, I guess I should show you what a modal is first if you don't know what one is.", 'start': 2358.351, 'duration': 3.603}, {'end': 2364.916, 'text': 'If I do the launch demo modal here,', 'start': 2362.615, 'duration': 2.301}, {'end': 2372.543, 'text': "then you can see that it's just something that pops up on your screen and kind of darkens everything in the background and give some text and some options here.", 'start': 2364.916, 'duration': 7.627}, {'end': 2375.205, 'text': "And this is where we'll have our close and delete,", 'start': 2372.843, 'duration': 2.362}, {'end': 2380.089, 'text': 'so that we can be sure that we want to actually delete that post and put in a delete confirmation there.', 'start': 2375.205, 'duration': 4.884}, {'end': 2381.73, 'text': "So that's what that looks like.", 'start': 2380.709, 'duration': 1.021}, {'end': 2385.073, 'text': 'So I will copy this entire modal section here.', 'start': 2382.09, 'duration': 2.983}, {'end': 2388.836, 'text': 'and I will paste this in to the end of our content section.', 'start': 2385.613, 'duration': 3.223}, {'end': 2394.541, 'text': 'So that is going to be after our article and right before the end of the content block.', 'start': 2389.116, 'duration': 5.425}, {'end': 2399.184, 'text': "So let me make sure that that indentation is correct and I'll save that.", 'start': 2394.961, 'duration': 4.223}, {'end': 2405.13, 'text': 'Now remember that we changed the data target on our button to be delete modal and not example modal.', 'start': 2399.465, 'duration': 5.665}, {'end': 2409.374, 'text': 'so everywhere that this says example modal, we want to change this to delete modal.', 'start': 2405.13, 'duration': 4.244}, {'end': 2423.928, 'text': "so i'm going to do a multi select here and copy all of the parts that say example modal and i think that i highlighted three here And I'm going to change all of those to be delete modal instead.", 'start': 2409.374, 'duration': 14.554}, {'end': 2430.775, 'text': "So before going any further with this deletion button, let's open this up in our browser and make sure that we got all of this correct so far.", 'start': 2424.288, 'duration': 6.487}, {'end': 2438.664, 'text': "So I will save all of that and we can open up our server here and make sure that it's still running and it is.", 'start': 2431.156, 'duration': 7.508}, {'end': 2445.005, 'text': "So I'll go back to our page and try to go to our page for one of our posts.", 'start': 2439.344, 'duration': 5.661}, {'end': 2451.627, 'text': 'And we can see that if it is a post that we have written, then we have our update and delete links here.', 'start': 2445.506, 'duration': 6.121}, {'end': 2457.728, 'text': 'Now if I click on update, then it takes us to the update route for that specific post.', 'start': 2451.967, 'duration': 5.761}, {'end': 2466.27, 'text': 'And if I go back and click on delete, then we can see that it pops up that example modal with the modal title and our options here.', 'start': 2458.188, 'duration': 8.082}, {'end': 2468.611, 'text': "Now for now, I'm just going to close that down.", 'start': 2466.43, 'duration': 2.181}], 'summary': 'Adding a delete button and modal for confirming post deletion in a web application using bootstrap.', 'duration': 23.105, 'max_score': 2283.779, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U2283779.jpg'}, {'end': 2672.455, 'src': 'embed', 'start': 2642.163, 'weight': 4, 'content': [{'end': 2644.644, 'text': "Okay, so now let's go create that delete post route.", 'start': 2642.163, 'duration': 2.481}, {'end': 2650.707, 'text': "Now I know that this is a lot to do for this delete route, but there's nothing more frustrating than deleting things that you don't mean to.", 'start': 2644.965, 'duration': 5.742}, {'end': 2655.449, 'text': 'So you want to go through the effort of getting in good habits of being a little careful here.', 'start': 2651.107, 'duration': 4.342}, {'end': 2657.609, 'text': "And that's what this whole process is about.", 'start': 2655.509, 'duration': 2.1}, {'end': 2663.151, 'text': "Okay, so now let's go back to our routes and create a route for deleting a post.", 'start': 2658.39, 'duration': 4.761}, {'end': 2667.513, 'text': 'Now this is going to be similar to our update route, at least the opening of it.', 'start': 2663.412, 'duration': 4.101}, {'end': 2672.455, 'text': "So let's copy the beginning of that and paste this in.", 'start': 2667.813, 'duration': 4.642}], 'summary': 'Creating a delete post route to avoid accidental deletions, emphasizing caution and good habits.', 'duration': 30.292, 'max_score': 2642.163, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U2642163.jpg'}], 'start': 1976.179, 'title': 'Adding update and delete functionality', 'summary': 'Covers adding update and delete functionality, including redirecting to specific posts, populating form data, adding a confirmation step for deleting posts, using bootstrap modal for delete confirmation, updating url with post id, creating a route for deleting posts, and testing the functionality.', 'chapters': [{'end': 2224.442, 'start': 1976.179, 'title': 'Updating and deleting posts', 'summary': 'Covers updating and deleting posts, including redirecting to specific posts, populating form data, and adding confirmation step for deleting posts, ensuring that users only see the update and delete links if the post belongs to them.', 'duration': 248.263, 'highlights': ['The chapter covers updating and deleting posts The chapter discusses updating and deleting posts, focusing on the process of updating and deleting posts for users.', 'Redirecting to specific posts and displaying flash messages The process involves redirecting to specific posts after updates and displaying flash messages to confirm the update, as well as ensuring that the post ID is included in the URL for the specific post.', 'Populating form data and conditional statements The transcript discusses populating form data for get requests and implementing conditional statements to ensure that the form is populated with values for get requests.', 'Adding confirmation step for deleting posts The chapter emphasizes the importance of adding an extra confirmation step for deleting posts to prevent accidental deletion, particularly for the delete route.', 'Ensuring users only see the update and delete links if the post belongs to them The chapter highlights the need to display update and delete links only if the post belongs to the current user, using conditional statements to control the visibility of these links.']}, {'end': 2423.928, 'start': 2224.442, 'title': 'Adding update and delete functionality', 'summary': 'Discusses adding update and delete functionality to a web page using bootstrap modal for delete confirmation and updating url with post id for the update functionality.', 'duration': 199.486, 'highlights': ['Using Bootstrap modal for delete confirmation The chapter demonstrates the use of a Bootstrap modal for delete confirmation, improving user experience and ensuring intentional post deletion.', 'Updating URL with post ID for update functionality The speaker explains how to update the URL with the post ID, enabling the functionality to update a specific post, enhancing user interaction with the website.', 'Utilizing button instead of anchor tag for delete functionality The chapter discusses the use of a button, styled with Bootstrap classes, for the delete functionality, enhancing the visual representation of the delete action.']}, {'end': 2880.295, 'start': 2424.288, 'title': 'Updating and deleting posts', 'summary': 'Covers updating the modal and buttons for post deletion, creating a route for deleting posts, and testing the functionality, with a focus on avoiding accidental deletions and ensuring proper user feedback.', 'duration': 456.007, 'highlights': ['Creating a route for deleting posts The transcript describes the process of creating a route for deleting posts, emphasizing the importance of avoiding accidental deletions and ensuring user feedback.', 'Updating the modal and buttons for post deletion The transcript details the process of updating the modal and buttons for post deletion, focusing on modifying the modal title and changing the button styles.', 'Testing the functionality for post deletion The transcript discusses testing the functionality for post deletion, including creating a new post, updating it, and successfully deleting it, ensuring proper user-specific actions.']}], 'duration': 904.116, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/u0oDDZrDz9U/pics/u0oDDZrDz9U1976179.jpg', 'highlights': ['Covers adding update and delete functionality, including redirecting to specific posts, populating form data, adding a confirmation step for deleting posts, using bootstrap modal for delete confirmation, updating url with post id, creating a route for deleting posts, and testing the functionality.', 'Redirecting to specific posts and displaying flash messages The process involves redirecting to specific posts after updates and displaying flash messages to confirm the update, as well as ensuring that the post ID is included in the URL for the specific post.', 'Using Bootstrap modal for delete confirmation The chapter demonstrates the use of a Bootstrap modal for delete confirmation, improving user experience and ensuring intentional post deletion.', 'Updating URL with post ID for update functionality The speaker explains how to update the URL with the post ID, enabling the functionality to update a specific post, enhancing user interaction with the website.', 'Creating a route for deleting posts The transcript describes the process of creating a route for deleting posts, emphasizing the importance of avoiding accidental deletions and ensuring user feedback.']}], 'highlights': ['The chapter discusses adding the ability for users to create, update, and delete posts, replacing dummy data with actual user-generated content.', 'Covers adding update and delete functionality, including redirecting to specific posts, populating form data, adding a confirmation step for deleting posts, using bootstrap modal for delete confirmation, updating url with post id, creating a route for deleting posts, and testing the functionality.', 'Creating a route for users to write new posts is outlined, emphasizing the need to establish a page for users to create posts.', 'The homepage route is modified to retrieve all posts from the database and display them on the homepage.', 'Using CSS classes to ensure the right sizing and padding for the article image.', 'The form used for updating the post is the same as the previous post form, demonstrating reusability.', 'Creating Routes for Updating and Deleting Posts The chapter demonstrates the creation of a route to display a form for updating a post, including the requirement for user login and the check to ensure that only the author of the post can update it.', 'The form needs to be populated with the content of the existing post being updated, achieved by setting form.title.data and form.content.data equal to the post title and content, respectively.', 'The chapter explains how to create a route to display a specific post, using the post ID as part of the route, fetching the post if it exists, and rendering a template to return the post.', 'The process involves redirecting to specific posts after updates and displaying flash messages to confirm the update, as well as ensuring that the post ID is included in the URL for the specific post.']}