commit
ae3c27c2cd
2 changed files with 10 additions and 9 deletions
|
@ -14,7 +14,7 @@ class BlogPlugin(CMSPluginBase):
|
||||||
module = 'Blog'
|
module = 'Blog'
|
||||||
|
|
||||||
|
|
||||||
class LatestEntriesPlugin(BlogPlugin):
|
class BlogLatestEntriesPlugin(BlogPlugin):
|
||||||
|
|
||||||
render_template = 'djangocms_blog/plugins/latest_entries.html'
|
render_template = 'djangocms_blog/plugins/latest_entries.html'
|
||||||
name = _('Latest Blog Articles')
|
name = _('Latest Blog Articles')
|
||||||
|
@ -28,7 +28,7 @@ class LatestEntriesPlugin(BlogPlugin):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class AuthorPostsPlugin(BlogPlugin):
|
class BlogAuthorPostsPlugin(BlogPlugin):
|
||||||
module = _('Blog')
|
module = _('Blog')
|
||||||
name = _('Author Blog Articles')
|
name = _('Author Blog Articles')
|
||||||
model = AuthorEntriesPlugin
|
model = AuthorEntriesPlugin
|
||||||
|
@ -74,8 +74,8 @@ class BlogArchivePlugin(BlogPlugin):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
plugin_pool.register_plugin(LatestEntriesPlugin)
|
plugin_pool.register_plugin(BlogLatestEntriesPlugin)
|
||||||
plugin_pool.register_plugin(AuthorPostsPlugin)
|
plugin_pool.register_plugin(BlogAuthorPostsPlugin)
|
||||||
plugin_pool.register_plugin(BlogTagsPlugin)
|
plugin_pool.register_plugin(BlogTagsPlugin)
|
||||||
plugin_pool.register_plugin(BlogArchivePlugin)
|
plugin_pool.register_plugin(BlogArchivePlugin)
|
||||||
plugin_pool.register_plugin(BlogCategoryPlugin)
|
plugin_pool.register_plugin(BlogCategoryPlugin)
|
||||||
|
|
|
@ -19,11 +19,10 @@ from .managers import GenericDateTaggedManager
|
||||||
|
|
||||||
BLOG_CURRENT_POST_IDENTIFIER = 'djangocms_post_current'
|
BLOG_CURRENT_POST_IDENTIFIER = 'djangocms_post_current'
|
||||||
|
|
||||||
|
|
||||||
class BlogCategory(TranslatableModel):
|
class BlogCategory(TranslatableModel):
|
||||||
"""
|
"""
|
||||||
Blog category
|
Blog category
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
parent = models.ForeignKey('self', verbose_name=_('parent'), null=True,
|
parent = models.ForeignKey('self', verbose_name=_('parent'), null=True,
|
||||||
blank=True)
|
blank=True)
|
||||||
|
@ -62,7 +61,8 @@ class Post(TranslatableModel):
|
||||||
"""
|
"""
|
||||||
Blog post
|
Blog post
|
||||||
"""
|
"""
|
||||||
author = models.ForeignKey(User, verbose_name=_('Author'), null=True, blank=True)
|
author = models.ForeignKey(User, verbose_name=_('Author'), null=True, blank=True,
|
||||||
|
related_name='djangocms_blog_author')
|
||||||
|
|
||||||
date_created = models.DateTimeField(auto_now_add=True)
|
date_created = models.DateTimeField(auto_now_add=True)
|
||||||
date_modified = models.DateTimeField(auto_now=True)
|
date_modified = models.DateTimeField(auto_now=True)
|
||||||
|
@ -73,7 +73,8 @@ class Post(TranslatableModel):
|
||||||
publish = models.BooleanField(_('Publish'), default=False)
|
publish = models.BooleanField(_('Publish'), default=False)
|
||||||
categories = models.ManyToManyField(BlogCategory, verbose_name=_('category'),
|
categories = models.ManyToManyField(BlogCategory, verbose_name=_('category'),
|
||||||
related_name='blog_posts',)
|
related_name='blog_posts',)
|
||||||
main_image = FilerImageField(verbose_name=_('Main image'), blank=True, null=True)
|
main_image = FilerImageField(verbose_name=_('Main image'), blank=True, null=True,
|
||||||
|
related_name='djangocmsblog_post_image')
|
||||||
main_image_thumbnail = models.ForeignKey(ThumbnailOption,
|
main_image_thumbnail = models.ForeignKey(ThumbnailOption,
|
||||||
verbose_name=_('Main image thumbnail'),
|
verbose_name=_('Main image thumbnail'),
|
||||||
related_name='blog_post_thumbnail',
|
related_name='blog_post_thumbnail',
|
||||||
|
@ -96,7 +97,7 @@ class Post(TranslatableModel):
|
||||||
content = PlaceholderField("post_content")
|
content = PlaceholderField("post_content")
|
||||||
|
|
||||||
objects = GenericDateTaggedManager()
|
objects = GenericDateTaggedManager()
|
||||||
tags = TaggableManager(blank=True)
|
tags = TaggableManager(blank=True, related_name='djangocms_blog_tags')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('blog article')
|
verbose_name = _('blog article')
|
||||||
|
|
Loading…
Reference in a new issue