Basic AJAX requests and handlebars template for each review. Still static page #4

Merged
andrewlalis merged 7 commits from al/script_basics into develop 2018-09-25 15:18:38 +00:00
1 changed files with 34 additions and 1 deletions
Showing only changes of commit 732e3d7daf - Show all commits

View File

@ -1,8 +1,41 @@
from django.db import models
# Represents any object for which reviews can be made. (Universities, Professors, etc.)
class RateableEntity(models.Model):
# The human-readable name of this entity.
name = models.CharField(max_length=256)
class Meta:
abstract = True
# A review represents any single data entry to the database.
class Review(models.Model):
# An integer rating which defines
# An integer rating in the domain [1, 5]
rating = models.IntegerField(default=1)
# 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(RateableEntity, on_delete=models.CASCADE)
# A RateableEntity for universities.
class University(RateableEntity):
pass
# A RateableEntity for professors, who belong to one or more university.
class Professor(RateableEntity):
# The universities that this professor teaches or has taught at.
university = models.ManyToManyField(University)
# A RateableEntity for courses, which belong to a university, and have one or more professors.
class Course(RateableEntity):
# The university that this course belongs to.
university = models.ForeignKey(University, on_delete=models.CASCADE)
# A list of professors that teach this course.
professors = models.ManyToManyField(RateableEntity)
# Create your models here.
class UniversityReview(models.Model):