Prevents blog plugin from crashing when there is no app_config present

Without this commit crashes with error: 'NoneType' object has no attribute 'template_prefix'
This commit is contained in:
Sami Kalliomäki 2015-11-13 17:22:27 +02:00
parent ec423a8d68
commit 25a8dcad87

View file

@ -16,7 +16,7 @@ class BlogPlugin(CMSPluginBase):
module = 'Blog' module = 'Blog'
def get_render_template(self, context, instance, placeholder): def get_render_template(self, context, instance, placeholder):
if instance.app_config.template_prefix: if instance.app_config and instance.app_config.template_prefix:
return os.path.join(instance.app_config.template_prefix, self.base_render_template) return os.path.join(instance.app_config.template_prefix, self.base_render_template)
else: else:
return os.path.join('djangocms_blog', self.base_render_template) return os.path.join('djangocms_blog', self.base_render_template)