Hi, I currently have this models: class Place(models.Model): (....)
class VoteContext(models.Model): name = models.CharField(max_length = 15, unique = True) class Vote(models.Model): place = models.ForeignKey(Place, related_name='voted_place') context = models.ForeignKey(VoteContext) added_time = models.DateField(auto_now_add = True) ip_address = models.IPAddressField() vote = models.IntegerField(default = 0) ----------------------------------------------------------------------------------------------------------------------------------------------- ie I could have something like this in the database ID | PLACE | CONTEXT | ... | VOTE 1 | 5 | 1 | ... |10 2 | 5 | 2 | ... | 9 3 | 5 | 3 | ... | 10 4 | 22 | 1 | ... | 10 5 | 22 | 2 | ... | 10 6 | 22 | 3 | ... | 10 ----------------------------------------------------------------------------------------------------------------------------------------------- My question is: How can I get the place with the highest votes/better average (using information from the context 1,2 and 3) and how can I get the place with the highest votes, let's say... regarding the context 1? I got stuck at the very beginning: Place.vote_set.all (...) Thanks in advance -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.