Hi Scott,

On Mon, 2006-07-31 at 16:54 -0700, Scott Paul Robertson wrote:
> I think I've found a bug when doing | (__or__) on QuerySets when or'ing
> with a QuerySet that filtered on a ManyToManyField. For example:
> 
> The Model (Ticket):
> shortdesc = models.CharField(maxlength=255)
> desc = models.TextField()
> users = models.ManyToManyField(django.contrib.auth.models.User)
> 
> There's only one Ticket at the moment:
> shortdesc = 'boo'
> desc = 'this has to do with linux'
> users = [spr, peter]
> 
> Then in the python shell (started with 'python manage.py shell') I do:
> >>> from tick.tickets.models import Ticket
> >>> s = Ticket.objects.filter(shortdesc__icontains='boo')
> >>> o = Ticket.objects.filter(users__username='boo')
> >>> s
> [<Ticket: boo (1)>]
> >>> o
> []
> >>> s | o
> [<Ticket: boo (1)>, <Ticket: boo (1)>]
> >>> p = Ticket.objects.filter(desc__icontains='linux')
> >>> p
> [<Ticket: boo (1)>]
> >>> p | o
> [<Ticket: boo (1)>, <Ticket: boo (1)>]
> >>>
> 
> This doesn't seem to be correct or behavior, based on what I'm seeing in
> the code. Is there something special I need to do when dealing with a
> ManyToMany, or is this a bug?

It's kind of a bug. We're working on rewriting the query generation
stuff to fix a few curly problems like this (and I mean that quite
literally -- I have the code open in front of me at the moment).

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to