#30804: Minor issue in Chaining filters section in given example code
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
ArjunAriyil |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 2.2
Documentation |
Severity: Normal | Keywords: Chaining filters
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
https://docs.djangoproject.com/en/2.2/topics/db/queries/
In the **Chaining filters** section,
"pub_date_**_gte**=datetime.date.today()" needs to be replaced with
"pub_date_**_lte**=datetime.date.today() to get entries published between
January 30, 2005, and the current day.
----
== Chaining filters
The result of refining a QuerySet is itself a QuerySet, so it’s possible
to chain refinements together. For example:
{{{
>>> Entry.objects.filter(
... headline__startswith='What'
... ).exclude(
... pub_date__gte=datetime.date.today()
... ).filter(
... pub_date__gte=datetime.date(2005, 1, 30)
... )
}}}
This takes the initial QuerySet of all entries in the database, adds a
filter, then an exclusion, then another filter. The final result is a
QuerySet containing all entries with a headline that starts with “What”,
that were published between January 30, 2005, and the current day.
--
Ticket URL: <https://code.djangoproject.com/ticket/30804>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.2bf4c2842e3c1f7f8aa8d60814870a65%40djangoproject.com.