#4849: Nested Filters
----------------------------------+-----------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: Core framework
Version: SVN | Keywords: filter, foreignkey
Stage: Unreviewed | Has_patch: 0
----------------------------------+-----------------------------------------
After review in #django I decided to post this as a bug.
3 and 4 should have the same output, shouldn't they?
{{{
>>> Article.objects.filter(tags=t1) #1
[<Article: A1>, <Article: A2>]
>>> Article.objects.filter(tags=t2) #2
[<Article: A1>]
>>> Article.objects.filter(tags=t1).filter(tags=t2) #3
[]
>>> Article.objects.filter(tags=t1, tags=t2) #4
[<Article: A1>]
}}}
Although 4 works, the syntax doesn't allow for someone working with a list
of tags.
Here are the models:
{{{
class Tag(models.Model):
name = models.CharField(maxlength=32, unique=True)
class Article(models.Model):
title = models.CharField(maxlength=255)
tags = models.ManyToManyField(Tag)
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/4849>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---