Answer the question
In order to leave comments, you need to log in
Why the error: AttributeError: 'str' object has no attribute '_meta'?
Making django comments using django-comments-xtd
During template creation, the error described in the question occurs.
Template (as stated in the documentation):
{% extends "layout/base.html" %}
{% load comments %}
{% block home %}
<body>
{% get_comment_count for object as comment_count %}
<div class="py-4 text-center">
<a href="{% url 'blog:post-list' %}">Back to the post list</a>
⋅
{{ comment_count }} comment{{ comment_count|pluralize }}
ha{{ comment_count|pluralize:"s,ve" }} been posted.
</div>
</body>
{% endblock %}
Answer the question
In order to leave comments, you need to log in
Judging by the error, you passed a string somewhere instead of a model object. More precisely, it is impossible to say without a full backtrace.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question