Ticket #13099: ticket_13099_update_example.diff

File ticket_13099_update_example.diff, 929 bytes (added by istruble, 15 years ago)
  • docs/ref/models/querysets.txt

     
    168168This example excludes all entries whose ``pub_date`` is later than 2005-1-3
    169169OR whose headline is "Hello"::
    170170
    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')
    172173
    173174In SQL terms, that evaluates to::
    174175
     
    176177    WHERE NOT pub_date > '2005-1-3'
    177178    OR NOT headline = 'Hello'
    178179
    179 Note the second example is more restrictive.
     180Note the second example is more restrictive.  See :ref:`complex queries <complex-lookups-with-q>` for more example lookups with OR.
    180181
     182
     183
    181184``annotate(*args, **kwargs)``
    182185~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    183186
Back to Top