Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RestaurantReview(models.Model):
- reviewer_name = models.CharField(max_length=100)
- restaurant = models.ForeignKey("Restaurant", on_delete=models.CASCADE)
- review_content = models.TextField()
- rating = models.PositiveIntegerField(validators=[validators.MaxValueValidator(5)])
- class Meta:
- abstract = True
- ordering = ["-rating"]
- verbose_name = "Restaurant Review"
- verbose_name_plural = "Restaurant Reviews"
- unique_together = ["reviewer_name", "restaurant"]
- class RegularRestaurantReview(RestaurantReview):
- pass
- class FoodCriticRestaurantReview(RestaurantReview):
- food_critic_cuisine_area = models.CharField(max_length=100)
- class Meta:
- ordering = ["-rating"]
- verbose_name = "Food Critic Review"
- verbose_name_plural = "Food Critic Reviews"
- unique_together = ["reviewer_name", "restaurant"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement