I've got the following models: class League(models.Model): league_name = models.CharField(max_length=100)
class School(models.Model): school_name = models.CharField(max_length=100) class SchoolSeason(models.Model): season = models.IntegerField() school = models.ForeignKey(School) league = models.ForeignKey(League) class CurrentRanking(models.Model): season = models.IntegerField() school = models.ForeignKey(School) wins = models.IntegerField() losses = models.IntegerField() rating = models.FloatField() I've created a view with the following: def rankings_index(request): ranking_list = CurrentRanking.objects.order_by('-rating') return render_to_response('college/rankings_index.html', {'ranking_list':ranking_list}) That returns all schools. But I want the view to return all schools who belong to a specific League. How would I do that? Do I need to write a custom query with SQL or can it be done with Django/Python? I'm still trying to train myself to think from an object point of view rather than what I'm used to (SQL). Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---