Multi table query

2010-03-02 Thread Lee Hinde
Hi; I've posted a diagram of what I'm trying to explain here: http://www.hinde.net/images/queryquestion.png I'm working on a tool for a screen printer. Products (t-shirts, hats, etc.) can be linked to multiple categories. A product can come in multiple colors and each color can come in a variety

Re: [database-api] Using .select_related() with a multi-table query (bug?)

2007-04-21 Thread Malcolm Tredinnick
On Wed, 2007-04-18 at 19:57 -0300, Luiz Carlos Geron wrote: > Hi, > I have three models, listed at [1], that I want to get data from with > only one query, because of performance issues with my app. The way > that worked so far is: > > league_ids = [12, 21] > bets = > models.Bet.objects.filter(g

Re: [database-api] Using .select_related() with a multi-table query (bug?)

2007-04-21 Thread Luiz Carlos Geron
Any ideas on how I can do this with one query? On 4/18/07, Luiz Carlos Geron <[EMAIL PROTECTED]> wrote: > Hi, > I have three models, listed at [1], that I want to get data from with > only one query, because of performance issues with my app. The way > that worked so far is: > > league_ids = [12,

[database-api] Using .select_related() with a multi-table query (bug?)

2007-04-18 Thread Luiz Carlos Geron
Hi, I have three models, listed at [1], that I want to get data from with only one query, because of performance issues with my app. The way that worked so far is: league_ids = [12, 21] bets = models.Bet.objects.filter(game__league__id__in=league_ids).order_by('bet__game__league.id', 'game_part'