Link submission

Let's look at what features we want to be related with link submissions. This is just a part of the features list that we saw at the start of the chapter:

  • Link submission by users
  • Voting on links submitted by other users
  • Commenting on the submissions and replying to comments by other users

Let's think about what models we'll need to implement this. First, we need a model to hold information about a single submission, such as the title, URL, who submitted the link, and at what time. Next, we need a way to track votes on submissions by users. This can be implemented by a ManyToMany field from the submission model to the User model. This way, whenever a user votes for a submission, we just add them to the set of related objects and remove ...

Get Django Project Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.