Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:52:56+00:00 2026-06-17T19:52:56+00:00

I just begin to study Django, and today come to the comment part, I

  • 0

I just begin to study Django, and today come to the comment part, I just practice from the Django Document.https://docs.djangoproject.com/en/1.4/ref/contrib/comments/example/. The command to add comment form works well when i do my practice on DetailView page
but now I also want to add a comment form to ListView page then it got this error.

below is the traceback:
Environment:
Request Method: GET

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'books',
'django.contrib.comments')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')


Template error:
In template /home/ryu/emacs/emacs-code/djcode/mysite2/templates/books/publisher_list.html, error at line 19
'str' object has no attribute '_meta'


9 :   <th> website</th>


10 : </tr>


11 : {% for publisher in object_list %}


12 : <tr>


13 :   <th><a href="/mysite2/publishers/{{publisher.id}}">{{ publisher.name }}</a></th>  


14 :   <th>{{publisher.country}}</th>


15 :   <th>{{publisher.website}}</th>


16 : </tr> 


17 : {% endfor %}


18 : </table>


19 :  {% render_comment_list for books.publisher %} 


20 : {% endblock %}


21 : 
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
136.                     response = response.render()
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in render
104.             self._set_content(self.rendered_content)
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in       rendered_content
81.         content = template.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
140.             return self._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
134.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
823.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
74.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
123.         return compiled_parent._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
134.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
823.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
74.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
123.         return compiled_parent._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
134.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
823.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
74.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
62.             result = block.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
823.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
74.             return node.render(context)
File "/usr/local/lib/python2.7/dist-          packages/django/contrib/comments/templatetags/comments.py" in render
201.         ctype, object_pk = self.get_target_ctype_pk(context)
File "/usr/local/lib/python2.7/dist- packages/django/contrib/comments/templatetags/comments.py" in get_target_ctype_pk
100.             return ContentType.objects.get_for_model(obj), obj.pk
File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py" in get_for_model
32.         opts = self._get_opts(model)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py" in   _get_opts
20.         return model._meta.concrete_model._meta

Exception Type: AttributeError at /mysite2/publishers/
Exception Value: 'str' object has no attribute '_meta'

now I want to know how could i add every page a comment using the build-in comments??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:52:58+00:00Added an answer on June 17, 2026 at 7:52 pm

    What you are saying then is that you pass appname.modelname to the template tag, you should actually pass an instance of the model to the template tag something like:

    {% render_comment_list for publisher %}
    

    if publisher is an instance of the Publisher model as it looks to be in your code. Or alternatively:

    {% render_comment_list for books.publisher publisher.id %}
    

    as psjinx mentioned above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just begin upgrade my asp.net site from Webform to MVC 2. So far
I just begin to study ARM assembly language, and am not clear about how
Just begin my Python/Django experience and i have a problem :-) So i have
Just switch from Python to C++ and I begin to re-write my Python tools
I just begin programming with android home widget, so i could set text to
Just before I begin heres a small overview of what I'm trying to achieve
I just began using Visual Studio to work on a practice .NET project. I
I just began reading more about Markov Chain Generators today, and am really intrigued
I just began looking into source control.... And installed subversion from collabnet... I also
Hey,firends,This is my first post. I'm just begin to using Gcc to compile java,and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.