O'Reilly logo

Django Project Blueprints by Asad Jibran Ahmed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required