and helpful!
On 24.04.2011 07:35, Alexander Schepanovski wrote:
> You can, with a subrequest:
> Blog.objects.filter(pk__in=Entry.objects.filter(pub_date__lte=date(2011,
> 4, 1), headline__contains='Lennon').values('blog').distinct())
Is this the same?
To my understanding, this is the subrequest-"equivalent" to the query in my first post:
Blog.objects.filter(entry__pub_date__lte=date(2011, 4, 1), entry__headline__contains='Lennon')
but I don't think it finds blogs whose *most recent* entry before or at April 1st has the word
"Easter" in the headline (or "Lennon", doesn't matter; sorry for the confusion that I accidentally
created in my first mail).
This is because if there is a blog that has
- an entry with pub_date = 2010-09-23 with headline "Easter", and
- another more recent entry with a headline that does *not* contain "Easter",
the above query would find the blog, but it shouldn't. Please correct me if my understanding is wrong!
Best regards,
Carsten
--
Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
Learn more at http://www.cafu.de
No comments:
Post a Comment