Fix quote style

This commit is contained in:
Iacopo Spalletti 2014-09-05 08:28:10 +02:00
parent 132707d593
commit e8beed43ab
6 changed files with 30 additions and 28 deletions

View file

@ -5,8 +5,8 @@ from django.utils.translation import ugettext_lazy as _
class BlogApp(CMSApp):
name = _("Blog")
urls = ["djangocms_blog.urls"]
name = _('Blog')
urls = ['djangocms_blog.urls']
app_name = 'djangocms_blog'
apphook_pool.register(BlogApp)

View file

@ -15,7 +15,7 @@ class BlogToolbar(CMSToolbar):
# TODO: Readd if not self.is_current_app condition when CMS 3.0.4 is released
if not self.request.user.has_perm('djangocms_blog.add_post'):
return # pragma: no cover
admin_menu = self.toolbar.get_or_create_menu("djangocms_blog", _('Blog'))
admin_menu = self.toolbar.get_or_create_menu('djangocms_blog', _('Blog'))
url = reverse('admin:djangocms_blog_post_changelist')
admin_menu.add_modal_item(_('Post list'), url=url)
url = reverse('admin:djangocms_blog_post_add')

View file

@ -14,5 +14,5 @@ class LatestEntriesForm(forms.ModelForm):
class Media:
css = {
'all': ('%sdjangocms_blog/css/%s' % (settings.STATIC_URL,
"djangocms_blog_admin.css"),)
'djangocms_blog_admin.css'),)
}

View file

@ -48,7 +48,7 @@ class TaggedFilterItem(object):
def tag_list_slug(self, other_model=None, queryset=None):
queryset = self.tag_list(other_model, queryset)
return queryset.values("slug")
return queryset.values('slug')
def tag_cloud(self, other_model=None, queryset=None, published=True):
from taggit.models import TaggedItem
@ -70,9 +70,9 @@ class TaggedFilterItem(object):
class GenericDateTaggedManager(TaggedFilterItem, TranslationManager):
use_for_related_fields = True
start_date_field = "date_published"
end_date_field = "date_published_end"
publish_field = "publish"
start_date_field = 'date_published'
end_date_field = 'date_published_end'
publish_field = 'publish'
def get_queryset(self, *args, **kwargs):
try:
@ -84,7 +84,7 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager):
queryset = self.published_future(queryset)
if self.start_date_field:
return queryset.filter(
**{"%s__lte" % self.start_date_field: now()})
**{'%s__lte' % self.start_date_field: now()})
else:
return queryset
@ -93,8 +93,8 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager):
queryset = self.get_queryset().all()
if self.end_date_field:
qfilter = (
models.Q(**{"%s__gte" % self.end_date_field: now()})
| models.Q(**{"%s__isnull" % self.end_date_field: True})
models.Q(**{'%s__gte' % self.end_date_field: now()})
| models.Q(**{'%s__isnull' % self.end_date_field: True})
)
queryset = queryset.filter(qfilter)
return queryset.filter(**{self.publish_field: True})
@ -104,8 +104,8 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager):
queryset = self.get_queryset().all()
if self.end_date_field:
qfilter = (
models.Q(**{"%s__lte" % self.end_date_field: now()})
| models.Q(**{"%s__isnull" % self.end_date_field: False})
models.Q(**{'%s__lte' % self.end_date_field: now()})
| models.Q(**{'%s__isnull' % self.end_date_field: False})
)
queryset = queryset.filter(qfilter)
return queryset.filter(**{self.publish_field: True})
@ -119,7 +119,9 @@ class GenericDateTaggedManager(TaggedFilterItem, TranslationManager):
return self.get_queryset().active_translations(language_code=language)
def get_months(self, queryset=None):
"""Get months with aggregate count (how much posts is in the month). Results are ordered by date."""
"""
Get months with aggregate count (how much posts is in the month). Results are ordered by date.
"""
if queryset is None:
queryset = self.get_queryset()
dates = queryset.values_list(self.start_date_field, flat=True)

View file

@ -101,7 +101,7 @@ class Post(ModelMeta, TranslatableModel):
post_text=HTMLField(_('Text'), default='', blank=True),
meta={'unique_together': (('language_code', 'slug'),)}
)
content = PlaceholderField("post_content")
content = PlaceholderField('post_content')
objects = GenericDateTaggedManager()
tags = TaggableManager(blank=True, related_name='djangocms_blog_tags')
@ -134,7 +134,7 @@ class Post(ModelMeta, TranslatableModel):
}
def get_keywords(self):
return self.safe_translation_getter('meta_keywords').strip().split(",")
return self.safe_translation_getter('meta_keywords').strip().split(',')
def get_description(self):
description = self.safe_translation_getter('meta_description', any_language=True)
@ -149,7 +149,7 @@ class Post(ModelMeta, TranslatableModel):
def get_tags(self):
taglist = [tag.name for tag in self.tags.all()]
return ",".join(taglist)
return ','.join(taglist)
def get_author(self):
return self.author
@ -157,7 +157,7 @@ class Post(ModelMeta, TranslatableModel):
class Meta:
verbose_name = _('blog article')
verbose_name_plural = _('blog articles')
ordering = ("-date_published", "-date_created")
ordering = ('-date_published', '-date_created')
get_latest_by = 'date_published'
def __unicode__(self):
@ -204,7 +204,7 @@ class LatestPostsPlugin(CMSPlugin):
help_text=_('Show only the blog articles tagged with chosen categories.'))
def __unicode__(self):
return u"%s latest articles by tag" % self.latest_posts
return u'%s latest articles by tag' % self.latest_posts
def copy_relations(self, oldinstance):
self.tags = oldinstance.tags.all()
@ -228,7 +228,7 @@ class AuthorEntriesPlugin(CMSPlugin):
)
def __unicode__(self):
return u"%s latest articles by author" % self.latest_posts
return u'%s latest articles by author' % self.latest_posts
def copy_relations(self, oldinstance):
self.authors = oldinstance.authors.all()

View file

@ -31,7 +31,7 @@ class BaseBlogView(ViewUrlMixin):
class PostListView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
template_name = "djangocms_blog/post_list.html"
template_name = 'djangocms_blog/post_list.html'
paginate_by = BLOG_PAGINATION
view_url_name = 'djangocms_blog:posts-latest'
@ -44,7 +44,7 @@ class PostListView(BaseBlogView, ListView):
class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):
model = Post
context_object_name = 'post'
template_name = "djangocms_blog/post_detail.html"
template_name = 'djangocms_blog/post_detail.html'
slug_field = 'slug'
view_url_name = 'djangocms_blog:post-detail'
@ -59,7 +59,7 @@ class PostDetailView(TranslatableSlugMixin, BaseBlogView, DetailView):
class PostArchiveView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
template_name = "djangocms_blog/post_list.html"
template_name = 'djangocms_blog/post_list.html'
date_field = 'date_published'
allow_empty = True
allow_future = True
@ -69,9 +69,9 @@ class PostArchiveView(BaseBlogView, ListView):
def get_queryset(self):
qs = super(PostArchiveView, self).get_queryset()
if 'month' in self.kwargs:
qs = qs.filter(**{"%s__month" % self.date_field: self.kwargs['month']})
qs = qs.filter(**{'%s__month' % self.date_field: self.kwargs['month']})
if 'year' in self.kwargs:
qs = qs.filter(**{"%s__year" % self.date_field: self.kwargs['year']})
qs = qs.filter(**{'%s__year' % self.date_field: self.kwargs['year']})
return qs
def get_context_data(self, **kwargs):
@ -85,7 +85,7 @@ class PostArchiveView(BaseBlogView, ListView):
class TaggedListView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
template_name = "djangocms_blog/post_list.html"
template_name = 'djangocms_blog/post_list.html'
paginate_by = BLOG_PAGINATION
view_url_name = 'djangocms_blog:posts-tagged'
@ -102,7 +102,7 @@ class TaggedListView(BaseBlogView, ListView):
class AuthorEntriesView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
template_name = "djangocms_blog/post_list.html"
template_name = 'djangocms_blog/post_list.html'
paginate_by = BLOG_PAGINATION
view_url_name = 'djangocms_blog:posts-authors'
@ -120,7 +120,7 @@ class AuthorEntriesView(BaseBlogView, ListView):
class CategoryEntriesView(BaseBlogView, ListView):
model = Post
context_object_name = 'post_list'
template_name = "djangocms_blog/post_list.html"
template_name = 'djangocms_blog/post_list.html'
_category = None
paginate_by = BLOG_PAGINATION
view_url_name = 'djangocms_blog:posts-category'