Merge pull request #161 from nephila/feature/smarter_methods
Use smarter ersion of get_templates and get_paginate_by
This commit is contained in:
commit
ec423a8d68
1 changed files with 3 additions and 8 deletions
|
@ -46,10 +46,8 @@ class BaseBlogView(AppConfigMixin, ViewUrlMixin):
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_template_names(self):
|
def get_template_names(self):
|
||||||
if self.config.template_prefix:
|
template_path = self.config.template_prefix or 'djangocms_blog'
|
||||||
return os.path.join(self.config.template_prefix, self.base_template_name)
|
return os.path.join(template_path, self.base_template_name)
|
||||||
else:
|
|
||||||
return os.path.join('djangocms_blog', self.base_template_name)
|
|
||||||
|
|
||||||
|
|
||||||
class PostListView(BaseBlogView, ListView):
|
class PostListView(BaseBlogView, ListView):
|
||||||
|
@ -64,10 +62,7 @@ class PostListView(BaseBlogView, ListView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_paginate_by(self, queryset):
|
def get_paginate_by(self, queryset):
|
||||||
if self.config.paginate_by:
|
return self.config.paginate_by or get_setting('PAGINATION')
|
||||||
return self.config.paginate_by
|
|
||||||
else:
|
|
||||||
return get_setting('PAGINATION')
|
|
||||||
|
|
||||||
|
|
||||||
class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):
|
class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):
|
||||||
|
|
Loading…
Reference in a new issue