Django comments not showing up in template

216 views Asked by At

I'm having trouble getting my comments to display in my template. When I test an objects comment in the shell - a list of comments are returned and they seem fine. However in my template they don't appear. It does take longer to load the page when I include {% load comments %} however nothing is shown when include {% render_comment_list for my_video %} where 'my_video' is my obj instance.

Any suggestions on how to debug this?

1

There are 1 answers

2
blacklwhite On

Try the following steps

  • Make sure, that there is at least one comment for the video. You can add the following at the beginning of your views.py: from django.contrib.comments.model import Comment and before rendering the template: print Comment.objects.filter(content_type = MyVideoType, object_pk = my_video.pk)

  • If you have comments, make sure that the comments are public.

  • Add the following to your urls.py

urlpatterns = patterns('',
    ...
    (r'^comments/', include('django.contrib.comments.urls')),
    ...
)
  • Make sure, that you have django.contrib.comments added to your INSTALLED_APPS in the settings.py.

Otherwise it would be helpful if you can show the view and the template.