コード例 #1
0
 def test_get_plugin_template(self):
     page = create_page(
         title="home",
         template="page.html",
         language="en",
     )
     instance = add_plugin(
         placeholder=page.placeholders.get(slot="content"),
         plugin_type=Bootstrap4CarouselPlugin.__name__,
         language="en",
     )
     template = get_plugin_template(
         instance,
         "carousel",
         "carousel",
         CAROUSEL_TEMPLATE_CHOICES,
     )
     self.assertEqual(
         template, "djangocms_bootstrap4/carousel/default/carousel.html")
     # trigger default template
     template = get_plugin_template(
         instance,
         "does_not",
         "exist",
         CAROUSEL_TEMPLATE_CHOICES,
     )
     self.assertEqual(template,
                      "djangocms_bootstrap4/does_not/default/exist.html")
     # cleanup
     page.delete()
コード例 #2
0
 def get_render_template(self, context, instance, placeholder):
     return get_plugin_template(
         instance.parent.get_plugin_instance()[0],
         'tabs',
         'item',
         TAB_TEMPLATE_CHOICES,
     )
コード例 #3
0
 def get_render_template(self, context, instance, placeholder):
     return get_plugin_template(
         instance.parent.get_plugin_instance()[0],
         'carousel',
         'slide',
         CAROUSEL_TEMPLATE_CHOICES,
     )
コード例 #4
0
 def get_render_template(self, context, instance, placeholder):
     return get_plugin_template(instance, 'tabs', 'tabs',
                                TAB_TEMPLATE_CHOICES)
コード例 #5
0
 def get_render_template(self, context, instance, placeholder):
     return get_plugin_template(instance, 'link', 'link', get_templates())
コード例 #6
0
 def get_render_template(self, context, instance, placeholder):
     return get_plugin_template(
         instance, 'carousel', 'carousel', CAROUSEL_TEMPLATE_CHOICES
     )
コード例 #7
0
 def get_render_template(self, context, instance, placeholder):
     return get_plugin_template(
         instance, 'carousel', 'carousel', [[instance.carousel_style]] if instance.carousel_style else CAROUSEL_TEMPLATE_CHOICES
     )