Learn how to build the base for creating a comment system. Explore how to create the comments and the functionality to manage the comments for a post.
- [Instructor] In the previous video,…we saw how to send emails with Django,…and render forms and templates.…This is the third video, Creating a Comment System.…This video will deal with building…a comment system for the blog.…Now we're going to build a comment system for the blog,…wherein the users will be able to comment on posts.…To build the comment system, you'll need…to create a model to save comments,…create a form to submit comments…and validate the input data,…add a view that processes the form,…and saves the new comment into the database,…edit the post_detail template to display…the list of comments, and the form for adding a new comment.…
First, let's build a model to store comments.…Open the models.py file of your blog application,…and add these lines of code.…This is our Comment model, it contains a ForeignKey…to associate the comment with a single post.…This many to one relationship…is defined in the Comment model,…because each Comment will be made on one Post,…and each Post might have multiple Comments.…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Building a blog application
- Creating an administration site for your models
- Creating templates for your views
- Using class-based views
- Enhancing your blog with advanced features
- Creating and handling forms
- Adding tagging functionality
- Extending your blog application
- Creating custom template tags and filters