django 给页面加了评论代码功能后,就总提示这样的错误?

cndeer 2012-05-01 12:26:01
加了评论代码后就是这样打不开内容页了
出错:
TemplateSyntaxError at /detail/1/
Invalid block tag: 'comment_form', expected 'endblock' 或 'endblock content'

我是如下操作的:
在页页模板里加入:
{% get_comment_list for messageboard.msg msg.id as comment_list %}
{% for comment in comment_list %}
<div class="comment">
<p>评论人:<b>{{comment.user.username}}</b> 评论时间:{{comment.submit_date|date:"Y-m-d H:i"}} IP地址:{{comment.ip_address}}</P>
{{comment.comment|urlizetrunc:400|linebreaks}}
</div>
{% endfor %}
{% comment_form for messageboard.msg msg.id %}



在settings.py 里加入
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.request',)



相应的模版也存在
comments/form.html
comments/posted.html

这是哪里出错了?谢谢
...全文
16812 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
perryyin 2012-05-03
  • 打赏
  • 举报
回复
comment_form的标签无法处理,请检查commentAPP的安装配置。特别是Tag处理部分。
cliffbaby 2012-05-03
  • 打赏
  • 举报
回复
这个错误是因为你的页面模板里少了 {{ endblock }} 标签。 你把页面模板代码全部贴出来!

37,741

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧