On 9/6/06, Guillermo Fernandez Castellanos <[EMAIL PROTECTED] > wrote:

I've checked the docs, but nothing seems to be wrong to me.
Any help appreciated, thanks.

I just tried the following using your models (plus a __str__ definition):
 
p1 = Person(name='russ')
p1.save()
p2 = Person(name='guillermo')
p2.save()
p3 = Person(name='guido')
p3.save()

c1 = Class(name='Music')
c1.save()
c2 = Class(name='Art')
c2.save()

p1.classes = [c1, c2]
p2.classes = [c1]
p3.classes = [c2]

>>>print Person.objects.filter(classes__id__exact=2)
[<Person: russ>, <Person: guido>]

>>>print Person.objects.filter(classes__name__startswith='Music')
[<Person: russ>, <Person: guillermo>]

>>>print Person.objects.filter(classes__name__exact='Music')
[<Person: russ>, <Person: guillermo>]

>>> print Person.objects.filter(classes__name__startswith='Mus')
[<Person: russ>, <Person: guillermo>]

>>> print Person.objects.filter(classes__name__exact='Mus')
[]

This seems to be correct. Perhaps it is a DB specific problem - what database are you using (my tests were with postgres)?

Also; after you have executed these queries, the following:

from django.db import connection
print connection.queries

will dump the exact SQL that was executed. This might be helpful in diagnosing the problem.

Yours,
Russ Magee %-)

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