On Sat, May 16, 2009 at 8:26 PM, ringemup <[email protected]> wrote:

>
>
> For the reference of anyone who comes across this in the future, you
> have to fetch the related model IDs as a list, like so:
>
> Entry.objects.filter(category="some category").values_list('id',
> flat=True)
>
>
> On May 16, 7:24 pm, ringemup <[email protected]> wrote:
> > Thanks -- that was exactly the sort of thing I was looking for!  Just
> > couldn't figure out how to do it.
> >
> >
> >
> > >
> Comment.objects.filter(content_type=ContentType.objects.get_for_model(Entry),
> > > object_pk__in=Entry.objects.filter(category="some category")).
> >
>
Err yeah, the syntax I used will only work in 1.1, and might not even work
then depending no how your DB handles int/string types (in PgSQL it won't
work if your object has integer primary keys).

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to