Re: Doing SQL subquery in extra

2008-03-02 Thread itpaul
Wooops I just realised my template var had a typo so it wasn't getting anything. Sorry. Nice tip for checking the sql though. It has been noted. a note to others: i was getting nothing to start with until i remembered that querysets are lazy. you might need to force evaluation to get your sql

Re: Doing SQL subquery in extra

2008-03-02 Thread itpaul
Wooops I just realised my template var had a typo so it wasn't getting anything. Sorry. Nice tip for checking the sql though. It has been noted. a note to others: i was getting nothing to start with until i remembered that querysets are lazy. you might need to force evaluation to get your sql

Re: Doing SQL subquery in extra

2008-03-01 Thread Malcolm Tredinnick
On Sat, 2008-03-01 at 15:25 -0800, itpaul wrote: > I got this from the docs and it gives an extra comment_count column. > great. > > discussion.objects.extra(select={'comment_count': 'SELECT COUNT(*) > FROM forum_commentextra WHERE forum_commentextra.discussion_id = > forum_discussion.id'},) >