Views do not crash if the config is not loadable

This commit is contained in:
Iacopo Spalletti 2016-03-09 23:47:09 +01:00
parent 228f69ef25
commit 85484e91a3

View file

@ -47,7 +47,7 @@ class BaseBlogView(AppConfigMixin, ViewUrlMixin):
return queryset return queryset
def get_template_names(self): def get_template_names(self):
template_path = self.config.template_prefix or 'djangocms_blog' template_path = (self.config and self.config.template_prefix) or 'djangocms_blog'
return os.path.join(template_path, self.base_template_name) return os.path.join(template_path, self.base_template_name)
@ -63,7 +63,7 @@ class PostListView(BaseBlogView, ListView):
return context return context
def get_paginate_by(self, queryset): def get_paginate_by(self, queryset):
return self.config.paginate_by or get_setting('PAGINATION') return (self.config and self.config.paginate_by) or get_setting('PAGINATION')
class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView): class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):