#NEWLINE# def test_num_item_queries( self ) : #NEWLINE# #INDENT# page3 = PlaceholderFieldTestPage . objects . create ( ) #NEWLINE# placeholder1 = Placeholder . objects . create_for_object ( page3 , 'field_slot1' ) #NEWLINE# item1 = RawHtmlTestItem . objects . create_for_placeholder ( placeholder1 , html = '<b>Item1!</b>' , sort_order = 1 ) #NEWLINE# item2 = RawHtmlTestItem . objects . create_for_placeholder ( page3 , html = '<b>Item2!</b>' , sort_order = 2 ) #NEWLINE# appsettings . FLUENT_CONTENTS_CACHE_OUTPUT = True #NEWLINE# appsettings . FLUENT_CONTENTS_CACHE_PLACEHOLDER_OUTPUT = False #NEWLINE# cache . clear ( ) #NEWLINE# with self . assertNumQueries ( 2 ) as ctx : #NEWLINE# #INDENT# self . _render ( '{% load fluent_contents_tags %}{% render_placeholder placeholder1 %}' , { #NEWLINE# #INDENT# 'placeholder1' : placeholder1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# with self . assertNumQueries ( 1 ) as ctx : #NEWLINE# #INDENT# self . _render ( '{% load fluent_contents_tags %}{% render_placeholder placeholder1 %}' , { #NEWLINE# #INDENT# 'placeholder1' : placeholder1 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# with self . assertNumQueries ( 2 ) as ctx : #NEWLINE# #INDENT# self . _render ( "{% load fluent_contents_tags %}{% page_placeholder 'field_slot1' %}" , { #NEWLINE# #INDENT# 'page' : page3 , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# with self . assertNumQueries ( 2 ) as ctx : #NEWLINE# #INDENT# self . _render ( "{% load fluent_contents_tags %}{% page_placeholder 'field_slot1' fallback=True %}" , { #NEWLINE# #INDENT# 'page' : page3 , #NEWLINE# #UNINDENT# } )