Merge pull request #218 from nephila/feature/more_robust_views
Views do not crash if the config is not loadable
This commit is contained in:
commit
adbbf855d3
1 changed files with 2 additions and 2 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue