[Django] #30804: Minor issue in Chaining filters section in given example code

4 просмотра
Перейти к первому непрочитанному сообщению

Django

не прочитано,
26 сент. 2019 г., 05:46:3626.09.2019
– django-...@googlegroups.com
#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.

Django

не прочитано,
26 сент. 2019 г., 12:10:0126.09.2019
– django-...@googlegroups.com
#30804: Minor issue in Chaining filters section in given example code
-------------------------------------+-------------------------------------
Reporter: ArjunAriyil | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 2.2
Severity: Normal | Resolution:

Keywords: Chaining filters | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Nicolas Pantel):

There is no issue.
The first filter excludes entries published after today, then the second
keep entries published after January 30, 2005.
The result are the entries published between January 30, 2005 and today,
as stated.

--
Ticket URL: <https://code.djangoproject.com/ticket/30804#comment:1>

Django

не прочитано,
26 сент. 2019 г., 12:10:3626.09.2019
– django-...@googlegroups.com
#30804: Minor issue in Chaining filters section in given example code
-------------------------------------+-------------------------------------
Reporter: ArjunAriyil | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: 2.2
Severity: Normal | Resolution: invalid

Keywords: Chaining filters | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nicolas Pantel):

* status: new => closed
* resolution: => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/30804#comment:2>

Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений