Hi, why does not the following work? My simple model:
class Author(models.Model): name = models.CharField(maxlength=255) def __str__(self): return self.name class Article(models.Model): author = models.ForeignKey(Author) title = models.CharField(maxlength=255) def __str__(self): return self.name Now, onto the action: ---------------------- In [10]: Author.objects.create(name='Jiri Barton') In [11]: Author.objects.filter(name='Jiri Barton') Out[11]: [<Author: Jiri Barton>] In [12]: Author.objects.filter(name='Jiri Barton') | Author.objects.filter(article__title__icontains='revealed') Out[12]: [] ------------------------- The database contains one row in the Author table. That's it. One would believe that Out[12] should be the same as Out[11]. This is very confusing. Adding an OR condition should never shrink the set. BTW, here is the SQL behind the scenes: SELECT `press_author`.`id`,`press_author`.`name` FROM `press_author` INNER JOIN `press_article` AS `press_author__article` ON `press_author`.`id` = `press_author__article`.`author_id` WHERE ((`press_author`.`name` = 'Jiri Barton') OR (`press_author__article`.`title` LIKE '%revealed%')) Is there another way I can phrase the query? TIA, Jiri --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---