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 out
i used l = len(qset)

            d = discussion.objects.extra(select={' ... sql blah ...
'},)
            l = len(d)
            from django.db import connection
            for q in connection.queries:
                print "############################################"
                print q


i must go to bed earlier

On Mar 2, 7:05 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> 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'},)
>
> > i also want to get the latest comment.
>
> > The sql ive got in this works fine in postgres, but not in django.
>
> You haven't explained what goes wrong when you try to do this in Django.
> If it gets as far as querying the database, have a look at the SQL that
> is generated (see the FAQ if you don't know how to do that) and compare
> that to what you expect to happen.
>
> Regards,
> Malcolm
>
> --
> If at first you don't succeed, destroy all evidence that you 
> tried.http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to