Ticket #14757: querysets.txt.diff

File querysets.txt.diff, 979 bytes (added by BernhardEssl, 4 years ago)
  • docs/ref/models/querysets.txt

     
    786786
    787787            SELECT * FROM blog_entry WHERE id IN (3, 4, 5, 20);
    788788
     789        Example with ``tables``::
     790
     791            Entry.objects.extra(tables=['blog_blog'], where=['name=%s'], params=['Beatles Blog'])
     792
     793        ...translates (roughly) into the following SQL::
     794
     795            SELECT blog_entry.* FROM blog_entry, blog_blog WHERE name='Beatles Blog';
     796
     797        In the previous case, a more portable solution would be to simply use ``filter()``::
     798
     799            Entry.objects.filter(blog__name='Beatles Blog')
     800
    789801        Be careful when using the ``tables`` parameter if you're specifying
    790802        tables that are already used in the query. When you add extra tables
    791803        via the ``tables`` parameter, Django assumes you want that table included
Back to Top