We need to allow users to vote on submissions. To keep things simple, we'll only allow
upvotes. A user can indicate that they like a submission. There is no way to indicate disapproval. This keeps the code and UI simple. We also want to ensure that one user can
upvote a submission only once and they can remove their
upvotes if they change their minds or upvoted a submission by mistake.
If you take another look at the
Link model, you'll see we already have an
upvotes field, which is a Machine to machine (M2M) with the
User model. This is the only database entry we'll need to allow and keep track of
upvotes by users. In order to upvote a submission, users will click on a link next to the submission. Until now, we were able to make do without ...