Fix: Added and adjusted test_template
This commit is contained in:
parent
a224fcca2e
commit
18959d35df
2 changed files with 15 additions and 9 deletions
|
@ -159,12 +159,11 @@ By defining the setting ``BLOG_PLUGIN_TEMPLATE_FOLDERS`` you can allow multiple
|
||||||
|
|
||||||
To use this feature define ``BLOG_PLUGIN_TEMPLATE_FOLDERS`` as a list of available templates. Each item of this list itself is a list of the form ``('[folder_name]', '[verbose name]')``. Example:
|
To use this feature define ``BLOG_PLUGIN_TEMPLATE_FOLDERS`` as a list of available templates. Each item of this list itself is a list of the form ``('[folder_name]', '[verbose name]')``. Example:
|
||||||
|
|
||||||
BLOG_PLUGIN_TEMPLATE_FOLDERS = (
|
BLOG_PLUGIN_TEMPLATE_FOLDERS = (
|
||||||
('plugins', _('Default template') ), # reads from "templates/djangocms_blog/plugins/
|
('plugins', _('Default template')), # reads from templates/djangocms_blog/plugins/
|
||||||
('timeline', _('Vertical timeline') ), # reads from "templates/djangocms_blog/vertical/
|
('timeline', _('Vertical timeline')), # reads from templates/djangocms_blog/vertical/
|
||||||
('masonry', _('Masonry style') ), # reads from "templates/djangocms_blog/masonry/
|
('masonry', _('Masonry style')), # reads from templates/djangocms_blog/masonry/
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
Once defined, the plugin admin interface will allow content managers to select which template the plugin will use.
|
Once defined, the plugin admin interface will allow content managers to select which template the plugin will use.
|
||||||
|
|
||||||
|
|
|
@ -189,11 +189,18 @@ class PluginTest(BaseTest):
|
||||||
|
|
||||||
context = self.get_plugin_context(pages[0], 'en', plugin)
|
context = self.get_plugin_context(pages[0], 'en', plugin)
|
||||||
plugin_class = plugin.get_plugin_class_instance()
|
plugin_class = plugin.get_plugin_class_instance()
|
||||||
self.assertEqual(plugin_class.get_render_template(context, plugin, ph), os.path.join('djangocms_blog', plugin_class.base_render_template))
|
self.assertEqual(plugin_class.get_render_template(context, plugin, ph),
|
||||||
|
os.path.join('djangocms_blog', plugin.template_folder, plugin_class.base_render_template))
|
||||||
|
|
||||||
self.app_config_1.app_data.config.template_prefix = 'whatever'
|
self.app_config_1.app_data.config.template_prefix = 'whatever'
|
||||||
self.app_config_1.save()
|
self.app_config_1.save()
|
||||||
self.assertEqual(plugin_class.get_render_template(context, plugin, ph), os.path.join('whatever', plugin_class.base_render_template))
|
tmp = plugin.template_folder
|
||||||
|
plugin.template_folder = 'whereever'
|
||||||
|
plugin.save()
|
||||||
|
self.assertEqual(plugin_class.get_render_template(context, plugin, ph),
|
||||||
|
os.path.join('whatever', 'whereever', plugin_class.base_render_template))
|
||||||
|
plugin.template_folder = tmp
|
||||||
|
plugin.save()
|
||||||
self.app_config_1.app_data.config.template_prefix = ''
|
self.app_config_1.app_data.config.template_prefix = ''
|
||||||
self.app_config_1.save()
|
self.app_config_1.save()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue