May 2018
Beginner to intermediate
526 pages
11h 57m
English
Now, we will build a comment system for the blog, wherein the users will be able to comment on posts. To build the comment system, you will need to do the following steps:
First, let's build a model to store comments. Open the models.py file of your blog application and add the following code:
class Comment(models.Model): post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name='comments') name = models.CharField(max_length=80) email = ...
Read now
Unlock full access