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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Django
#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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/054.2bf4c2842e3c1f7f8aa8d60814870a65%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

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

Django
#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 <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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/069.f79ba86e2180b52d0f67725b2a781f42%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

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

Django
In reply to this post by Django
#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>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/069.a489a902760c5bcc8450217cc6470779%40djangoproject.com.