Querying across many-to-many relations

2008-12-14 Thread Malcolm Tredinnick
(You forgot to include a title. I nearly nuked this as spam, by accident. So I've thrown in a title for fun.) On Sun, 2008-12-14 at 19:50 -0800, Info Cascade wrote: > Hi -- > > I have a question about many-to-many relationships and how to reference > a related object field using Django syntax vi

Re: Querying across many-to-many relations

2008-12-14 Thread Info Cascade
Malcolm, Thanks for pointing that out! That set me on the right course, and I was able to get things working with _ArticleRank_ this time. I have a follow-up, though. Not every article has been assigned a rank. When a search includes an article without a rank I get an error. I can just trap the

Re: Querying across many-to-many relations

2008-12-14 Thread Malcolm Tredinnick
On Sun, 2008-12-14 at 21:02 -0800, Info Cascade wrote: > Malcolm, > > Thanks for pointing that out! That set me on the right course, and I > was able to get things working with _ArticleRank_ this time. > I have a follow-up, though. Not every article has been assigned a > rank. When a search in

Re: Querying across many-to-many relations

2008-12-14 Thread Info Cascade
A more complete explanation: Ordering on the related table works fine as long as all the articles have an associated ArticleRank (article_rank.rank, depending on how you look at it). > order_by = '-articlerank__rank' > art_list = Article.objects.filter(\ > title__icontains=ter