Merge branch 'develop' of github.com:nephila/djangocms-blog into develop

This commit is contained in:
Iacopo Spalletti 2016-05-11 17:22:40 +02:00
commit 9c228df813
No known key found for this signature in database
GPG key ID: BDCBC2EB289F60C6
3 changed files with 13 additions and 30 deletions

View file

@ -14,6 +14,7 @@ History
* Fixed error with on_site filter
* Removed meta-mixin compatibility code
* Changed slug size to 255 chars
* Fixed pagination setting in list views
0.7.0 (2016-03-19)
++++++++++++++++++

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
__author__ = 'Iacopo Spalletti'
__email__ = 'i.spalletti@nephila.it'
__version__ = '0.8.0.b7'
__version__ = '0.8.0.b8'
default_app_config = 'djangocms_blog.apps.BlogAppConfig'

View file

@ -19,6 +19,7 @@ User = get_user_model()
class BaseBlogView(AppConfigMixin, ViewUrlMixin):
model = Post
def get_view_url(self):
if not self.view_url_name:
@ -51,14 +52,12 @@ class BaseBlogView(AppConfigMixin, ViewUrlMixin):
return os.path.join(template_path, self.base_template_name)
class PostListView(BaseBlogView, ListView):
model = Post
class BaseBlogListView(BaseBlogView):
context_object_name = 'post_list'
base_template_name = 'post_list.html'
view_url_name = 'djangocms_blog:posts-latest'
def get_context_data(self, **kwargs):
context = super(PostListView, self).get_context_data(**kwargs)
context = super(BaseBlogListView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT')
return context
@ -67,7 +66,6 @@ class PostListView(BaseBlogView, ListView):
class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):
model = Post
context_object_name = 'post'
base_template_name = 'post_detail.html'
slug_field = 'slug'
@ -102,14 +100,14 @@ class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):
return context
class PostArchiveView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
base_template_name = 'post_list.html'
class PostListView(BaseBlogListView, ListView):
view_url_name = 'djangocms_blog:posts-latest'
class PostArchiveView(BaseBlogListView, ListView):
date_field = 'date_published'
allow_empty = True
allow_future = True
paginate_by = get_setting('PAGINATION')
view_url_name = 'djangocms_blog:posts-archive'
def get_queryset(self):
@ -126,15 +124,10 @@ class PostArchiveView(BaseBlogView, ListView):
if kwargs['year']:
kwargs['archive_date'] = now().replace(kwargs['year'], kwargs['month'] or 1, 1)
context = super(PostArchiveView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT')
return context
class TaggedListView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
base_template_name = 'post_list.html'
paginate_by = get_setting('PAGINATION')
class TaggedListView(BaseBlogListView, ListView):
view_url_name = 'djangocms_blog:posts-tagged'
def get_queryset(self):
@ -145,15 +138,10 @@ class TaggedListView(BaseBlogView, ListView):
kwargs['tagged_entries'] = (self.kwargs.get('tag')
if 'tag' in self.kwargs else None)
context = super(TaggedListView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT')
return context
class AuthorEntriesView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
base_template_name = 'post_list.html'
paginate_by = get_setting('PAGINATION')
class AuthorEntriesView(BaseBlogListView, ListView):
view_url_name = 'djangocms_blog:posts-authors'
def get_queryset(self):
@ -165,16 +153,11 @@ class AuthorEntriesView(BaseBlogView, ListView):
def get_context_data(self, **kwargs):
kwargs['author'] = User.objects.get(**{User.USERNAME_FIELD: self.kwargs.get('username')})
context = super(AuthorEntriesView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT')
return context
class CategoryEntriesView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
base_template_name = 'post_list.html'
class CategoryEntriesView(BaseBlogListView, ListView):
_category = None
paginate_by = get_setting('PAGINATION')
view_url_name = 'djangocms_blog:posts-category'
@property
@ -200,5 +183,4 @@ class CategoryEntriesView(BaseBlogView, ListView):
def get_context_data(self, **kwargs):
kwargs['category'] = self.category
context = super(CategoryEntriesView, self).get_context_data(**kwargs)
context['TRUNCWORDS_COUNT'] = get_setting('POSTS_LIST_TRUNCWORDS_COUNT')
return context