-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Django Project Blueprints
By :
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:
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 them if they decide to take back their vote.
Commenting as a feature is separate from link submissions because it can be implemented as a separate model that links to the submission model with ForeignKey. We'll look at commenting...