2012-04-01 82 views
1

我試圖使用評論框架在我的網站上實施評論。我已經按照文件:Django評論框架問題

https://docs.djangoproject.com/en/dev/ref/contrib/comments/

https://docs.djangoproject.com/en/dev/ref/contrib/comments/example/

我的模板是這樣的:

{% extends "pbase.html" %} 
{% load comments %} 
{% block bcontent %} 

    <div class="main"> 
     <a href="{{ backurl }}">&lt;&lt; back</a> 
     <!-- Image --> 
     <ul> 
      {% if image.title %} 
       <div class="title">{{ image.title }}</div> 
      {% endif %} 
      <ul> 
       <img border="0" alt="" src="{{ media_url }}{{ image.image.name }}" width="900" /> 
      </ul> 
     </ul> 
     {% load comments %} 
     {% get_comment_count for photo.image object_pk as comment_count %} 
     <p>{{ comment_count }} comments have been posted.</p> 
     {% render_comment_list for photo.image object_pk %} 
     {% render_comment_form for photo.image object_pk %} 
    </div> 

{% endblock %} 

在我的頁面的評論的數量是展示而不是評論本身或者形式。我錯過了什麼?

感謝

+0

您是否創建了'comments/list.html'模板? – 2012-04-01 12:44:49

+0

如果你只是做了{%載入評論%} {%render_comment_list for photo.image%}'會怎麼樣? – agf 2012-04-01 12:48:24

+0

從文檔我明白,有一個默認的list.html模板?我想在定製之前使用它。 @agf我得到的錯誤「Caught AttributeError呈現時:'str'對象沒有屬性'_meta'」謝謝 – 2012-04-01 12:50:57

回答

2

photo.image應該只是image。我知道image是正確的,因爲你在模板的其他地方使用它,如果它錯了,你會注意到。