Re: many-to-many queryset question

2012-01-07 Thread Carsten Fuchs
Hi Peter, Am 2012-01-07 03:40, schrieb Peter of the Norse: One possibility is to try two excludes. bad_authors = Authors.objects.exclude(pk__in=SetOfAuthors) qs = Entry.objects.exclude(authors__in=bad_authors) This will return all entries that don't have authors in SetOfAuthors. It might even

Re: many-to-many queryset question

2012-01-06 Thread Peter of the Norse
One possibility is to try two excludes. bad_authors = Authors.objects.exclude(pk__in=SetOfAuthors) qs = Entry.objects.exclude(authors__in=bad_authors) This will return all entries that don't have authors in SetOfAuthors. It might even be easier, if you can skip creating SetOfAuthors in the first

Re: many-to-many queryset question

2011-12-06 Thread Felipe Morales
could you possibly show the query generated?... # print qs.query 2011/12/6 Carsten Fuchs > Hi all, > > looking at the example models Author and Entry at > https://docs.djangoproject.**com/en/1.3/topics/db/queries/, > I would like to run

many-to-many queryset question

2011-12-06 Thread Carsten Fuchs
Hi all, looking at the example models Author and Entry at https://docs.djangoproject.com/en/1.3/topics/db/queries/, I would like to run a query like this: SetOfAuthors = Authors.objects.filter(...) qs = Entry.objects.filter(authors__in=SetOfAuthors) such that (pseudo-code):