Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#17589 closed Uncategorized (invalid)

mistype in -> Django 1.1 1.2 1.3 dev - QuerySet API reference - exclude(**kwargs)

Reported by: g1ra Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal Keywords: exclude mistype
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

in documentation https://docs.djangoproject.com/en/1.3/ref/models/querysets/#exclude
end of the /exclude/ QuerySet refinement method
Django 1.0 is correct, but other version contains mistype.

Bad:

SELECT ...
WHERE NOT pub_date > '2005-1-3'
AND NOT headline = 'Hello'

Correct (in Django 1.0):

SELECT ...
WHERE NOT pub_date > '2005-1-3'
OR NOT headline = 'Hello'

Change History (4)

comment:1 by Claude Paroz, 13 years ago

Resolution: invalid
Status: newclosed

Sorry, but your assertion seems wrong to me.

comment:2 by g1ra, 13 years ago

SELECT ...
WHERE NOT (pub_date > '2005-1-3' AND headline = 'Hello')
is same as
SELECT ...
WHERE NOT pub_date > '2005-1-3'
AND NOT headline = 'Hello'

then
Entry.objects.exclude(pub_dategt=datetime.date(2005, 1, 3), headline='Hello')
is same as
Entry.objects.exclude(pub_date
gt=datetime.date(2005, 1, 3)).exclude(headline='Hello')
???

comment:3 by Claude Paroz, 13 years ago

To sum up IRC discussions on this subject, here are some tables:

Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3), headline='Hello')
SELECT ... WHERE NOT (pub_date > '2005-1-3' AND headline = 'Hello')
pub_date headline boolean result
2004-04-01 Hello 0 1 -> 0 -> 1
2006-04-01 Nice 1 0 -> 0 -> 1
2004-04-01 Blue 0 0 -> 0 -> 1
2006-04-01 Hello 1 1 -> 1 -> 0
Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3)).exclude(headline='Hello')
SELECT ... WHERE NOT pub_date > '2005-1-3' AND NOT headline = 'Hello'
pub_date headline boolean result
2004-04-01 Hello 0 1 -> 1 0 -> 0
2006-04-01 Nice 1 0 -> 0 1 -> 0
2004-04-01 Blue 0 0 -> 1 1 -> 1
2006-04-01 Hello 1 1 -> 0 0 -> 0

in reply to:  2 comment:4 by Ramiro Morales, 13 years ago

Replying to g1ra:

SELECT ...

Please please please use the Preview option before posting ticket or comments to tickets. You've posted twice so far and in both ocassions what you've written is completely unreadable.

Note: See TracTickets for help on using tickets.
Back to Top