4
4
# USEFUL FUNCTIONS FOR FLUENT CONTENTS #############################################################
5
5
6
6
# 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 ):
8
8
"""
9
9
Creates a content instance from a content plugin class.
10
10
11
11
: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
13
13
instance one.
14
14
:param placeholder_name: The placeholder name defined in the
15
15
template. [DEFAULT: main]
@@ -18,23 +18,23 @@ def create_content_instance(content_plugin_class, test_page, placeholder_name='m
18
18
:return: The content instance created.
19
19
"""
20
20
# 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 )
22
22
23
23
# If a placeholder exists for the placeholder_name use the first one provided otherwise create
24
24
# a new placeholder instance.
25
25
if placeholders .exists ():
26
26
placeholder = placeholders [0 ]
27
27
else :
28
- placeholder = test_page .create_placeholder (placeholder_name )
28
+ placeholder = page .create_placeholder (placeholder_name )
29
29
30
30
# 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 ))
32
32
33
33
# Create the actual plugin instance.
34
34
try :
35
35
content_instance = content_plugin_class .objects .create (
36
36
parent_type = ct ,
37
- parent_id = test_page .id ,
37
+ parent_id = page .id ,
38
38
placeholder = placeholder ,
39
39
** kwargs
40
40
)
0 commit comments