Changes between Initial Version and Version 1 of Ticket #20963, comment 8
- Timestamp:
- Aug 26, 2013, 4:25:40 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #20963, comment 8
initial v1 1 Model: `tests.queries.models.Item` 1 Model: `tests.queries.models.Item`. 2 2 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) 5 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 6 >>> print len(Item.objects.filter(tags__isnull=False).order_by('tags')) 7 0 8 >>> print Item.objects.filter(tags__isnull=False).order_by('tags').count() 9 5 5 10 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 10 12 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_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)) 14 5 15 >>> print Item.objects.filter(tags__isnull=False).count() 16 5 11 17 }}}