here, I want to add the LatestEntriesPlugin.
But it doen't work. I have more than 3 blog post, but when I want to create this plugin with the latest 3, I get no blog posts at all.
I found out the issue was in LatestEntriesPlugin model. When I comment the __unicode__, all works perfectly:
class LatestEntriesPlugin(CMSPlugin):
latest_entries = models.IntegerField(default=5, help_text=_('The number of latests entries to be displayed.'))
tags = models.ManyToManyField('taggit.Tag', blank=True, help_text=_('Show only the blog posts tagged with chosen tags.'))
# def __unicode__(self):
# return str(self.latest_entries)
def copy_relations(self, oldinstance):
self.tags = oldinstance.tags.all()
def get_posts(self):
posts = Post.published.filter_by_language(self.language)
tags = list(self.tags.all())
if tags:
posts = posts.filter(tags__in=tags)
return posts[:self.latest_entries]
One question is, why is this __unicode__ here? Regarding this model is not available in the admin site, it seems this code is overflowing...
So I have a cms page with a placeholder,
{% static_placeholder "newsitems" %}
here, I want to add the LatestEntriesPlugin. But it doen't work. I have more than 3 blog post, but when I want to create this plugin with the latest 3, I get no blog posts at all.
I found out the issue was in LatestEntriesPlugin model. When I comment the
__unicode__
, all works perfectly:One question is, why is this
__unicode__
here? Regarding this model is not available in the admin site, it seems this code is overflowing...