Advertisement
horozov86

3. Restaurant Review

Nov 22nd, 2023
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. class RestaurantReview(models.Model):
  2.     reviewer_name = models.CharField(max_length=100)
  3.     restaurant = models.ForeignKey("Restaurant", on_delete=models.CASCADE)
  4.     review_content = models.TextField()
  5.     rating = models.PositiveIntegerField(validators=[validators.MaxValueValidator(5)])
  6.    
  7.     class Meta:
  8.         ordering = ["-rating"]
  9.         verbose_name = "Restaurant Review"
  10.         verbose_name_plural = "Restaurant Reviews"
  11.         unique_together = ["reviewer_name", "restaurant"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement