Ticket #13099: ticket_13099_replace_example.diff

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

     
    165165    SELECT ...
    166166    WHERE NOT (pub_date > '2005-1-3' AND headline = 'Hello')
    167167
    168 This example excludes all entries whose ``pub_date`` is later than 2005-1-3
    169 OR whose headline is "Hello"::
     168See :ref:`complex queries <complex-lookups-with-q>` for example lookups with OR.
    170169
    171     Entry.objects.exclude(pub_date__gt=datetime.date(2005, 1, 3)).exclude(headline='Hello')
    172 
    173 In SQL terms, that evaluates to::
    174 
    175     SELECT ...
    176     WHERE NOT pub_date > '2005-1-3'
    177     OR NOT headline = 'Hello'
    178 
    179 Note the second example is more restrictive.
    180 
    181170``annotate(*args, **kwargs)``
    182171~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    183172
Back to Top