Re: Need help with a filter in a view

2009-09-26 Thread jeffself
Thanks Jim. I'll give this a shot. On Sep 25, 8:24 pm, Jim McGaw wrote: > What you might be asking for is the following syntax, that allows you > to perform queries against the data in more than one table: > > CurrentRanking.objects.filter > (school__schoolseason__league__league_name="League Na

Re: Need help with a filter in a view

2009-09-26 Thread jeffself
Derek, I actually had done my model the way you suggested, but changed my mind. I guess I should listen to my first instinct! Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: Need help with a filter in a view

2009-09-25 Thread Derek Willis
Jim's right, but I'd also suggest redoing your CurrentRanking model so it has just one foreign key, to SchoolSeason (since that in turn has fk's to the School model): class League(models.Model): league_name = models.CharField(max_length=100) class School(models.Model): school_name = mode

Re: Need help with a filter in a view

2009-09-25 Thread Jim McGaw
What you might be asking for is the following syntax, that allows you to perform queries against the data in more than one table: CurrentRanking.objects.filter (school__schoolseason__league__league_name="League Name").order_by('- rating') Those are double underscores between the model names and

Re: Need help with a filter in a view

2009-09-25 Thread jeffself
Oops. I should have said my current view returns a list of rankings (school_name, rating) rather than all schools. On Sep 25, 7:59 pm, jeffself wrote: > I've got the following models: > > class League(models.Model): >     league_name = models.CharField(max_length=100) > > class School(models.Mod

Need help with a filter in a view

2009-09-25 Thread jeffself
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