Hi guys,
I tried Join.Together's approach using the "in" filter parameter and
it worked great. It turns out that the other query I was running was
actually producing the wrong result set! Not Django's fault, rather I
was pulling in the wrong data. The code looks nicer and is definitely
more maintainable now.
I'm quite looking forward to reducing more overhead with tips like
this.
Thanks a lot Join and Malcolm!
Mike.
On Aug 28, 5:43 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I'm going to give this a try. I'll let you know how I get on!
>
> Thanks guys!
>
> Mike.
>
> On Aug 27, 6:18 pm, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > user_id_list=User.objects.filter(whatever).values_list('id',
> > flat=True)
> > posts=Post.objects.filter(user__id__in=user_id_list)
>
> > Would that work?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---