Ticket #13099: ticket_13099_update_example.diff
File ticket_13099_update_example.diff, 929 bytes (added by , 15 years ago) |
---|
-
docs/ref/models/querysets.txt
168 168 This example excludes all entries whose ``pub_date`` is later than 2005-1-3 169 169 OR whose headline is "Hello":: 170 170 171 Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3)).exclude(headline='Hello') 171 Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3)) | 172 Entry.objects.exclude(headline='Hello') 172 173 173 174 In SQL terms, that evaluates to:: 174 175 … … 176 177 WHERE NOT pub_date > '2005-1-3' 177 178 OR NOT headline = 'Hello' 178 179 179 Note the second example is more restrictive. 180 Note the second example is more restrictive. See :ref:`complex queries <complex-lookups-with-q>` for more example lookups with OR. 180 181 182 183 181 184 ``annotate(*args, **kwargs)`` 182 185 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 186