On Aug 14, 8:57 pm, DrakerNet2 <[EMAIL PROTECTED]> wrote: > How do I obtain thedifferencebetweenQueryset1 and 2 (i.e. how do I > obtain all records fromQueryset1 that do not appear inQueryset2?
I've been trying to work this out as well. I have an answer, but not one that I'm very happy with. To retrieve a list of all the books *not* in a library I can write: >>> books = Book.objects.exclude(pk__in=library.books.values('pk').query) It seems a shame to have to specify the primary key here and I don't like poking around inside the implementation to get at the query attribute. I was hoping for something a little cleaner like: >>> books = Book.objects.all() - library.books.all() Am I missing something? Thanks Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---