You need a little more power than what you're doing. My initial reaction would be to use operator and Q objects:
from django.db.models import Q import operator Q_user_search = reduce(operator.or_, [Q(first = first, last=last) for (first, last) in authorList]) Authors.objects.filter(Q_user_search) -Mike On May 24, 10:53 pm, jmborr <[EMAIL PROTECTED]> wrote: > Please help the newbie! > I have a list of authors: > authorList=( ('john','doe') , ('jane','smith') ) > If I want to filter a table of authors (containing 'first' and 'last' > fields) by their last name only, that much I know: > Authors.objects.filter( last_in=[ last for (first,last) in > authorList ] ) > But how can I filter the table using first and last name at the same > time??? > Note that the following will not do: > Authors.objects.filter( last_in=[ last for (first,last) in > authorList ] ).filter( first_in=[ first for (first,last) in > authorList ] ) > > -jose --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---