Re: Django Query to get max rating

2015-03-18 Thread Filipe Ximenes
>From what I could understand, you are trying to fetch all the top ratings for each question in a group, correct? The problem is that this query: top_rated_list = Ratings.objects.get(rating = max_rating) ​ is returning more than one rating instance. "get" queries are supposed to return a single

Django Query to get max rating

2015-03-18 Thread Yadnesh Patil
My model structure is like this: class Group(models.Model): u_id= models.ForeignKey(User) group_name = models.CharField(max_length=50,unique=True) def __str__(self): # __unicode__ on Python 2 return self.group_name + " " + self.org_nam