'str' object has no attribute 'comments' #192
-
|
So, i have added everything to this page https://django-comment-dab.readthedocs.io/Web%20API.html bu i keep getting the error in title. i cloned this github page and pasted all the updated comment...html files in the comment folder you say we shd create from the docs. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 15 replies
-
|
Hey @HelloMukama, Are you using the api or the UI? Can you please share the traceback? It seems to me that you didn't pass the right object to
No. This is only needed if you would like to customize the current UI. |
Beta Was this translation helpful? Give feedback.
-
|
@HelloMukama, Edit: Move the {% extends "base/base.html" %}
{% block title %} Submission | Details {% endblock %}
{% load static %}
{% load comment_tags %} {# Loading the template tag #}
{% block content %}
<div class="row ml-3 pl-lg-4">
<div class="col-12 col-xl-12 ml-3">
<div class="card card-body shadow-sm mb-4">
<h6 class="mb-4">Details of this submission <span>as of {{time.now}}</span></h6>
<div class="">
<h6>About the User that made the submission</h6>
<p>Full Names: {{ submission.profile.user.first_name }} {{ submission.profile.user.last_name }}</p>
<p>Email Address: {% if not submission.profile.email %}
<span class="text-danger">User has no email address</span>{% else %}{{ submission.profile.email }}{% endif %}
</p>
</div>
<div>
<h6>The submission. <span style="font-size: small; color: darkblue;">Last edited on {{ submission.updated }}</span></h6>
<p>Title: <span class="text-uppercase">{{ submission.submission }}</span></p>
<p>Date Of Submission: <span style="color: darkblue;">{{ submission.timestamp }}</span></p>
</div>
<div>
<h6>Details</h6>
<p>{{ submission.description }}</p>
</div>
<div>
{% render_comments submission request %} {# Use the actual object#}
</div>
</div>
</div>
</div>
{% endblock %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}{% endblock %} |
Beta Was this translation helpful? Give feedback.
@HelloMukama,
Replace
objin the comment tags withsubmissionyour actual object.Update your details.html as following:
Edit: Move the
{% render_comments submission request %}inside the{% block content %}and get rid of{% get_comments_count obj user %}.