Dear django users, Being rather new to django, I can't wrap my head around the following: I am trying to execute a query from a search form. The search form has three fields, Names, Dates and Places. I want to AND the queries, so that if Names and Places are filled in, I want to return only records that match both.
My idea was to build up the condition in a dictionary while looking through the fields returned from the form like this: if places: Q['places'] = Q(persplace__icontains=places) if names: Q['names'] = Q(persname__icontains=names) etc and then concatenate and execute the whole at the end: results = Person.objects.filter("|".join(Q.values()) However this does not seem to work. I imagine that this is a rather frequent requirement, so there should be an easy way to do this, but I just can't figure it out. Any help appreciated, Chris --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---