Changes between Initial Version and Version 1 of Ticket #20963, comment 8


Ignore:
Timestamp:
Aug 26, 2013, 4:25:40 AM (11 years ago)
Author:
loic84

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20963, comment 8

    initial v1  
    1 Model: `tests.queries.models.Item`
     1Model: `tests.queries.models.Item`.
    22
    3 {{{
    4 -- Item.objects.filter(tags__isnull=False).order_by('tags').query
     3{{{#!python
     4>>> print(Item.objects.filter(tags__isnull=False).order_by('tags').query)
     5SELECT "queries_item"."id", "queries_item"."name", "queries_item"."created", "queries_item"."modified", "queries_item"."creator_id", "queries_item"."note_id" FROM "queries_item" INNER JOIN "queries_item_tags" ON ( "queries_item"."id" = "queries_item_tags"."item_id" ) INNER JOIN "queries_tag" ON ( "queries_item_tags"."tag_id" = "queries_tag"."id" ) WHERE "queries_item_tags"."tag_id" IS NOT NULL ORDER BY "queries_tag"."name" ASC
     6>>> print len(Item.objects.filter(tags__isnull=False).order_by('tags'))
     70
     8>>> print Item.objects.filter(tags__isnull=False).order_by('tags').count()
     95
    510
    6 SELECT "queries_item"."id", "queries_item"."name", "queries_item"."created", "queries_item"."modified", "queries_item"."creator_id", "queries_item"."note_id" FROM "queries_item" INNER JOIN "queries_item_tags" ON ( "queries_item"."id" = "queries_item_tags"."item_id" ) INNER JOIN "queries_tag" ON ( "queries_item_tags"."tag_id" = "queries_tag"."id" ) WHERE "queries_item_tags"."tag_id" IS NOT NULL ORDER BY "queries_tag"."name" ASC
    7 
    8 -- Item.objects.filter(tags__isnull=False).query
    9 
     11>>> print Item.objects.filter(tags__isnull=False).query
    1012SELECT "queries_item"."id", "queries_item"."name", "queries_item"."created", "queries_item"."modified", "queries_item"."creator_id", "queries_item"."note_id" FROM "queries_item" INNER JOIN "queries_item_tags" ON ( "queries_item"."id" = "queries_item_tags"."item_id" ) INNER JOIN "queries_note" ON ( "queries_item"."note_id" = "queries_note"."id" ) WHERE "queries_item_tags"."tag_id" IS NOT NULL ORDER BY "queries_note"."note" DESC, "queries_item"."name" ASC
     13>>> print len(Item.objects.filter(tags__isnull=False))
     145
     15>>> print Item.objects.filter(tags__isnull=False).count()
     165
    1117}}}
Back to Top