Hi - new to the group here. And new to Django too.

I'm having trouble understanding how to use the database API to get
data back which includes any data from a table with a ManyToManyField
relationship. eg, below.

The function below searches in the first_name and last_name fields in
the Client table and this works fine. However, in the Client object I
want to have the data from the table Instrument, which has a
ManyToManyField relationship with Client. What do I need to add to the
below code to achieve that?

def client_search(request, client_search):
    client_list =
Client.objects.filter(Q(first_name__icontains=client_search) |
Q(last_name__icontains=client_search))
    return render_to_response('diary/client_search.htm',
{'client_list': client_list})

Thankyou so much.


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