1👍
✅
Instead of:
class Restaurant(models.Model):
#fields here
class Food(models.Model):
rating = RatingField(range=5, weight=5,can_change_vote = True,allow_delete = True,allow_anonymous = True)
restaurant = models.OneToOneField(Restaurant)
class Service(models.Model):
rating = RatingField(range=5, weight=5,can_change_vote = True,allow_delete = True,allow_anonymous = True)
restaurant = models.OneToOneField(Restaurant)
Try:
class Restaurant(models.Model):
#fields here
food_rating = RatingField(range=5, weight=5,can_change_vote = True,allow_delete = True,allow_anonymous = True)
service_rating = RatingField(range=5, weight=5,can_change_vote = True,allow_delete = True,allow_anonymous = True)
👤jpic
Source:stackexchange.com