Sorry, I haven't delved deeply into the orm sql generator to help much more. I will ask, did this issue arise when you tried to assertNumQueries(1) and it returned with an error: 2 queries run? On Wednesday, September 11, 2013 3:00:29 PM UTC-5, [email protected] wrote: > > Oh, I'm sorry. Here's a link to the relevant model file: > https://github.com/Fantomas42/django-blog-zinnia/blob/master/zinnia/models_bases/entry.py > . > (Entry is just a subclass of AbstractEntry) The tags and tags_list > attributes are defined in the TagsEntry class. (I'm sorry the model is so > big. That's one reason I was just asking in general instead of this > specific instance) > > Even when I don't access the tags field, I get two hits: > > with self.assertNumQueries(expected_query_count) as q: > all_entries = list(Entry.objects.all()) > for query in q.captured_queries: > print(query, "\n") > > produces: > > {'sql': 'QUERY = \'SELECT "zinnia_entry"."id", "zinnia_entry"."title", > "zinnia_entry"."slug", "zinnia_entry"."status", > "zinnia_entry"."start_publication", "zinnia_entry"."end_publication", > "zinnia_entry"."creation_date", "zinnia_entry"."last_update", > "zinnia_entry"."content", "zinnia_entry"."comment_enabled", > "zinnia_entry"."pingback_enabled", "zinnia_entry"."trackback_enabled", > "zinnia_entry"."comment_count", "zinnia_entry"."pingback_count", > "zinnia_entry"."trackback_count", "zinnia_entry"."excerpt", > "zinnia_entry"."image", "zinnia_entry"."featured", "zinnia_entry"."tags", > "zinnia_entry"."login_required", "zinnia_entry"."password", > "zinnia_entry"."content_template", "zinnia_entry"."detail_template" FROM > "zinnia_entry" ORDER BY "zinnia_entry"."creation_date" DESC\' - PARAMS = > ()', 'time': '0.000'} > > {'sql': 'QUERY = \'SELECT "tagging_tag"."id", "tagging_tag"."name" FROM > "tagging_tag" INNER JOIN "tagging_taggeditem" ON ( "tagging_tag"."id" = > "tagging_taggeditem"."tag_id" ) WHERE > ("tagging_taggeditem"."content_type_id" = %s AND > "tagging_taggeditem"."object_id" = %s ) ORDER BY "tagging_tag"."name" ASC\' > - PARAMS = (13, 1)', 'time': '0.000'} > >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

