diff --git a/backend/postings/models.py b/backend/postings/models.py index d7a0514..bc1038a 100644 --- a/backend/postings/models.py +++ b/backend/postings/models.py @@ -9,14 +9,24 @@ class RateableEntity(models.Model): class Review(models.Model): # An integer rating in the domain [1, 5] rating = models.IntegerField(default=1) + # A title for the review (brief summary of sentiment) + title = models.CharField(max_length=128) # The textual content of the review. content = models.TextField() - # An integer representing the number of times a user found this review helpful. - helpful_vote_count = models.IntegerField(default=1) - # An integer representing the number of times a user found this review unhelpful. - unhelpful_vote_count = models.IntegerField(default=1) # A foreign key referencing the entity for which this review was made. - rateable_entity_id = models.ForeignKey('postings.RateableEntity', on_delete=models.CASCADE) + rateable_entity = models.ForeignKey('postings.RateableEntity', on_delete=models.CASCADE) + # The date and time at which this review was published. + created_date = models.DateTimeField(auto_now_add=True) + # The date and time at which the last modification to this review was published. + last_updated_date = models.DateTimeField(auto_now=True) + +# A vote for a review as either positive or negative. +class ReviewHelpfulVote(models.Model): + # A reference to the review that this vote is for. + review = models.ForeignKey('postings.Review', on_delete=models.CASCADE) + # Whether or not the referenced review was helpful. + helpful = models.BooleanField() + # TODO: Add a reference to the user who voted. The whole purpose of a separate vote object is to track who votes for what. # A RateableEntity for universities. class University(RateableEntity): diff --git a/frontpage/index2.html b/frontpage/index2.html index 2c47647..9c25473 100644 --- a/frontpage/index2.html +++ b/frontpage/index2.html @@ -184,7 +184,7 @@