summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-08 16:00:26 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-08 16:00:26 +0000
commit169b8894868555345a6fbaa885d7034e8dd1a16e (patch)
treee826427409c8b20f0587bdeccad71a8432cfbc85 /docs
parent90b6e1438fe95c915334ceb57c34f2fa19b91002 (diff)
Fixed #7546 -- Fixed an incorrect example in the docs that was misleading some
people. Patch from Dan Watson. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/db-api.txt12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index f62d5c6d57..4f03a4810d 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -1708,8 +1708,8 @@ When you are filtering an object based on a ``ManyToManyField`` or a reverse
interested in. Consider the ``Blog``/``Entry`` relationship (``Blog`` to
``Entry`` is a one-to-many relation). We might be interested in finding blogs
that have an entry which has both *"Lennon"* in the headline and was published
-today. Or we might want to find blogs that have an entry with *"Lennon"* in
-the headline as well as an entry that was published today. Since there are
+in 2008. Or we might want to find blogs that have an entry with *"Lennon"* in
+the headline as well as an entry that was published in 2008. Since there are
multiple entries associated with a single ``Blog``, both of these queries are
possible and make sense in some situations.
@@ -1728,16 +1728,16 @@ earlier ``filter()`` call.
That may sound a bit confusing, so hopefully an example will clarify. To
select all blogs that contains entries with *"Lennon"* in the headline and
-were published today, we would write::
+were published in 2008, we would write::
Blog.objects.filter(entry__headline__contains='Lennon',
- entry__pub_date=datetime.date.today())
+ entry__pub_date__year=2008)
To select all blogs that contain an entry with *"Lennon"* in the headline
-**as well as** an entry that was published today, we would write::
+**as well as** an entry that was published in 2008, we would write::
Blog.objects.filter(entry__headline__contains='Lennon').filter(
- entry__pub_date=datetime.date.today())
+ entry__pub_date__year=2008)
In this second example, the first filter restricted the queryset to all those
blogs linked to that particular type of entry. The second filter restricted