Basic AJAX requests and handlebars template for each review. Still static page #4
|
@ -9,14 +9,24 @@ class RateableEntity(models.Model):
|
||||||
class Review(models.Model):
|
class Review(models.Model):
|
||||||
# An integer rating in the domain [1, 5]
|
# An integer rating in the domain [1, 5]
|
||||||
rating = models.IntegerField(default=1)
|
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.
|
# The textual content of the review.
|
||||||
content = models.TextField()
|
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.
|
# 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.
|
# A RateableEntity for universities.
|
||||||
class University(RateableEntity):
|
class University(RateableEntity):
|
||||||
|
|
|
@ -184,7 +184,7 @@
|
||||||
<!-- Handlebars templates -->
|
<!-- Handlebars templates -->
|
||||||
<!-- TODO: Use a templating engine to automatically include all handlebars templates required for a certain page. -->
|
<!-- TODO: Use a templating engine to automatically include all handlebars templates required for a certain page. -->
|
||||||
<script id="review_item_handlebars" type="text/x-handlebars-template">
|
<script id="review_item_handlebars" type="text/x-handlebars-template">
|
||||||
<div class="row" id="{{id}}">
|
<div class="row" id="{{pk}}">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
<img src="http://dummyimage.com/60x60/666/ffffff&text=No+Image" class="img-rounded">
|
<img src="http://dummyimage.com/60x60/666/ffffff&text=No+Image" class="img-rounded">
|
||||||
<div class="review-block-name"><a href="#">{{username}}</a></div>
|
<div class="review-block-name"><a href="#">{{username}}</a></div>
|
||||||
|
|
Loading…
Reference in New Issue