My site is actually a wagtail site, although I'm not sure if that makes a difference. It's a simple blog application with a blog page to view posts and a page to show each post.
I was following the instructions here to setup django-comments-xtd
The documentation says to implement the following code to get a comment count displayed on each post page.
{% get_comment_count for object as comment_count %}
<div class="text-center" style="padding-top:20px">
<a href="{% url 'blog:post-list' %}">Back to the post list</a>
⋅
{{ comment_count }} comments have been posted.
</div>
I changed the actual link to be the following, as that is what it was in my site (built from another tutorial)
<p><a href="{{ page.get_parent.url }}">Return to blog</a></p>
I don't think changing the url like that would cause the problem, from what I can tell. I have made sure to load comments at the start of the file also.
The actual error is:
Error during template rendering
In template /home/jake/blog/blog/post_page.html, error at line 8
'str' object has no attribute '_meta'
Line 8 refers to this line:
{% get_comment_count for object as comment_count %}
Could someone explain this error in more detail?
object? I guess an empty string''. If you open Python and do>>> ''._metayou get an errorAttributeError: 'str' object has no attribute '_meta'. Could it be that django-comments-xtd keeps the comment count per page? Eg:{% get_comment_count for page as comment_count %}- allcaps{{ object }}orobjis used. Becauseobjcan be any object (Pizzas, Cars, Questions). The default object in Wagtail is a Page object. Thepagevariable name is well chosen. I guess the real problem is that you do not know the context: All the vars and their values that are used to fill the template. - allcapsget_contextit returns a dict.{'page': self, 'self': self, 'request': request}. See github.com/wagtail/wagtail/blob/master/wagtail/core/… . There is noobjectin the context! The django-comments-xtd developers just wrote Django code. You can comment on any object. You decided to use it in combination with Wagtail. So the object is a page. There is nothing wrong. - allcaps