#35318: The documentation for Django's exclude() method contains a potentially
misleading statement regarding the restrictiveness of two examples
provided.
-------------------------------------+-------------------------------------
               Reporter:  P1car00n   |          Owner:  nobody
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:             |        Version:  5.0
  Documentation                      |       Keywords:  QuerySet,
               Severity:  Normal     |  Clarification, Accuracy
           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/5.0/ref/models/querysets/#exclude In
 the Django documentation for the exclude() method], there's a statement
 comparing two examples where one is claimed to be more restrictive than
 the other. However, upon careful examination, it appears that the
 statement is inaccurate.

 The documentation states:
   "The second example is more restrictive."

 However, this statement contradicts the actual behavior of the examples
 provided:

 **First Example:**
 {{{
 Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3),
 headline="Hello")
 }}}

 This example excludes entries where both conditions (pub_date being later
 than January 3, 2005, and headline being "Hello") are true. It is more
 restrictive than the second example because it requires both conditions to
 be false for an entry to be excluded.

 **Second Example:**
 {{{
 Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1,
 3)).exclude(headline="Hello")
 }}}

 This example excludes entries where either condition (pub_date being later
 than January 3, 2005, or headline being "Hello") is true. It is less
 restrictive than the first example because it allows for excluding entries
 based on either condition being true.

 The issue is very easy to fix, but I wanted somebody with more experience
 with SQL to have a look first.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35318>
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/0107018e58608473-1e4e31af-28a3-4a47-8522-7b31f96b4739-000000%40eu-central-1.amazonses.com.

Reply via email to