44# USEFUL FUNCTIONS FOR FLUENT CONTENTS #############################################################
55
66# Fluent Contents Helper Functions #################################################################
7- def create_content_instance (content_plugin_class , test_page , placeholder_name = 'main' , ** kwargs ):
7+ def create_content_instance (content_plugin_class , page , placeholder_name = 'main' , ** kwargs ):
88 """
99 Creates a content instance from a content plugin class.
1010
1111 :param content_plugin_class: The class of the content plugin.
12- :param test_page : The fluent_page instance to create the content
12+ :param page : The fluent_page instance to create the content
1313 instance one.
1414 :param placeholder_name: The placeholder name defined in the
1515 template. [DEFAULT: main]
@@ -18,23 +18,23 @@ def create_content_instance(content_plugin_class, test_page, placeholder_name='m
1818 :return: The content instance created.
1919 """
2020 # Get the placeholders that are currently available for the slot.
21- placeholders = test_page .get_placeholder_by_slot (placeholder_name )
21+ placeholders = page .get_placeholder_by_slot (placeholder_name )
2222
2323 # If a placeholder exists for the placeholder_name use the first one provided otherwise create
2424 # a new placeholder instance.
2525 if placeholders .exists ():
2626 placeholder = placeholders [0 ]
2727 else :
28- placeholder = test_page .create_placeholder (placeholder_name )
28+ placeholder = page .create_placeholder (placeholder_name )
2929
3030 # Obtain the content type for the page instance class.
31- ct = ContentType .objects .get_for_model (type (test_page ))
31+ ct = ContentType .objects .get_for_model (type (page ))
3232
3333 # Create the actual plugin instance.
3434 try :
3535 content_instance = content_plugin_class .objects .create (
3636 parent_type = ct ,
37- parent_id = test_page .id ,
37+ parent_id = page .id ,
3838 placeholder = placeholder ,
3939 ** kwargs
4040 )
0 commit comments