Hi
Not sure I completely get your code. If client_search initially is a
variable holding a string I assume you're aware that declaring a
function with the same name will override the original variable...
When you write ´´first_name__icontains=client_search´´, is
client_search supposed to hold a string or function reference? I guess
it's the former.
Assuming the Client contains a many-to-many field called instruments
and each Instrument has a name field that you want to include in your
search, I think you should be able to write something like:
Client.objects.filter(Q(first_name__icontains=search_string) |
                      Q(last_name__icontains=search_string) |
                      Q(instruments__name__icontains=search_string)
                      ).distinct()

Hope this helps. For more info please see the ManyToMany examples here:
http://www.djangoproject.com/documentation/models/many_to_many/

Martin


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to