请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

评论删除bug

在def get_thread(request)中
thread_html = render_to_string("news/news_thread.html", {"thread": news.get_thread(), 'request': request})
这边需要把reuqest返回回去不然前面news_thread模板中的
 {% if request.user.username == reply.user.username %}
                   <a href="{% url 'news:delete_news' reply.pk %}">
                     <i class="fa fa-times pull-right" aria-hidden="true" title="点击删除这条动态"></i>
                   </a>
 {% endif %}
 不会判断 导致评论无法删除

正在回答 回答被采纳积分+3

插入代码

1回答

Jack 2020-01-25 23:55:33

是的,如果要做删除评论功能的话,课程没做这个功能点。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号