Hi,
I've think I've found a bug with complex queries and QOr. Here is the
test case model I've reduced it to:
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Article(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, blank=True, null=True)
def __str__(self):
return self.title
and here is the test code to reproduce the problem:
>>> from qorbug.models import Author, Article
>>> from django.db.models import Q
>>> author = Author.objects.create(name="John Doe")
>>> Article.objects.create(title="Article One", author=author)
<Article: Article One>
>>> Article.objects.create(title="Article Two")
<Article: Article Two>
>>> Article.objects.filter(Q(title__icontains="article") |
>>> Q(author__name__icontains="article"))
[<Article: Article One>]
For that last query I was expecting:
>>> Article.objects.filter(Q(title__icontains="article") |
>>> Q(author__name__icontains="article"))
[<Article: Article One>, <Article: Article Two>]
as both Articles have "article" in their title.
Am I wrong to expect that or have I hit a bug?
I'm running this on django trunk r5888 and postgresql backend.
regards
matthew
--
http://wadofstuff.blogspot.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---