In the below text there appears to be a few errors:
fixes preceded by >>
This example excludes all entries whose pub_date is the current date/time AND whose headline is “Hello”:
>> s#the current date/time#later than 2005-1-3#
Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3), headline='Hello')
In SQL terms, that evaluates to:
SELECT ...
WHERE NOT (pub_date > '2005-1-3' AND headline = 'Hello')
This example excludes all entries whose pub_date is the current date/time OR whose headline is “Hello”:
>> s#the current date/time OR whose headline is "Hello"#later than 2005-1-3 AND whose headline is NOT "Hello"#
>> the below code means: get all rows whose pub_date is not later then 2005-1-3 and then query THAT queryset for all headlines which are not equal to Hello -- so it should be 'exclude all entries whose pub_date is later than 2005-1-3 AND whose headline is not "Hello"
Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3)).exclude(headline='Hello')
In SQL terms, that evaluates to:
SELECT ...
WHERE NOT pub_date > '2005-1-3'
AND NOT headline = 'Hello'