Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 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'

Attachments (0)

Change History (4)

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Sorry, but your assertion seems wrong to me.

comment:2 follow-up: Changed 2 years ago by g1ra

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 Changed 2 years ago by claudep

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

comment:4 in reply to: ↑ 2 Changed 2 years ago by ramiro

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.