class User(models.Model):
name=models.CharField(max_length=50,blank=True,null=True)
latitude = models.CharField('Latitude', max_length=30, blank=True, null=True)
longitude = models.CharField('Longitude', max_length=30, blank=True, null=True)
location = models.PointField(blank=True, null=True)
def __str__(self):
return str(self.name)
class Restaurant(models.Model):
restaurant_name=models.CharField(max_length=50,blank=True,null=True)
latitude = models.CharField('Latitude', max_length=30, blank=True, null=True)
longitude = models.CharField('Longitude', max_length=30, blank=True, null=True)
location = models.PointField(blank=True, null=True)
def __str__(self):
return str(self.restaurant_name)
class RestaurantRating(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE,null=True,related_name="customer_rating")
restaurant = models.ForeignKey(Restaurant, on_delete=models.CASCADE, null=True, related_name="rating_restaurant")
rating = models.FloatField()
def __str__(self):
return str(self.user)
How can i filter the restaurants whose rating is 5,Restaurant.objects.filter()
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cdaa9adf-5b4e-4de7-9c9d-f9e875e17acbn%40googlegroups.com.
No comments:
Post a Comment