Re: Using queryset values() spanning relationships

2007-08-16 Thread NickJ
That works perfectly, thanks. I was going about it the wrong way with values(). On Aug 14, 7:16 pm, Collin Grady <[EMAIL PROTECTED]> wrote: > Author.objects.filter(book__publisher__id=1).distinct() doesn't work? --~--~-~--~~~---~--~~ You received this message bec

Re: Using queryset values() spanning relationships

2007-08-14 Thread Collin Grady
Author.objects.filter(book__publisher__id=1).distinct() doesn't work? --~--~-~--~~~---~--~~ 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 unsub

Re: Using queryset values() spanning relationships

2007-08-14 Thread r_f_d
You should be able to do this: p = Publisher.objects.get(pk=1) authors = Author.objects.filter(book__publisher__exact = p).distinct() list = ([(a.id, a.name) for a in authors]) I don't have a python shell handy so I do not know for sure that the syntax is correct, but I do things like this all

Re: Using queryset values() spanning relationships

2007-08-14 Thread NickJ
Sorry, think I've answered my own question: Further searching found a similar request in developers a couple of months back: http://groups.google.com/group/django-developers/browse_thread/thread/ef2d981e49ba1b4d/a4c531b8b4880cd0 Which didn't get any love. So I guess I'll need to drop in to SQL f