Re: Duplicate results using ORd Q queries

2009-08-08 Thread Luke Seelenbinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tom, The reason it was returning dupes is simply you had multiple querysets that matched some of the same items. As for the while loop, it was malformed. It looks like an infinite loop to me... I might be wrong; however, a for loop would have better

Re: Duplicate results using ORd Q queries

2009-08-08 Thread Tom
Luke, That's brilliant, thank you so much! Just out of interest, do you know why the query was returning dupes in the first place, and why my while loop was not removing them? Thanks again, Tom On Aug 8, 2:51 pm, Luke Seelenbinder wrote: > Tom, > > make your line read: > results = Film.objec

Re: Duplicate results using ORd Q queries

2009-08-08 Thread Luke Seelenbinder
Tom, make your line read: results = Film.objects.filter( Q(title__icontains=q) | Q(director__name__icontains=q) | Q(actors__name__icontains=q) | Q(screenwriters__name__i

Duplicate results using ORd Q queries

2009-08-08 Thread Thomas Scrace
Hi all, In order to teach myself Django I am creating a simple film database project. My search code looks like this: results = Film.objects.filter( Q(title__icontains=q) | Q(director__name__icontains=q) |