django-comments - 回复如何与 django_comments_xtd 中的评论相关联
问题描述
我正在查看 django_comments_xtd 的源代码。当用户通过点击“回复”回复现有评论时,
## /templates/django_comments_xtd/comment_tree.html
{% if item.comment.allow_thread and not item.comment.is_removed %}
{% if allow_feedback %} <span class="text-muted">•</span> {% endif %}<a class="small mutedlink" href="{{ item.comment.get_reply_url }}">{% trans "Reply" %}</a>
{% endif %}
用户将被带到http://example.com/comments/reply/(comment_pk)
并由 处理views.rely
。
## django_comments_xtd/views.py
def reply(request, cid):
...
return render(request, "django_comments_xtd/reply.html",
{"comment": comment, "form": form, "cid": cid, "next": next})
然后在django_comments_xtd/reply.html
## django_comments_xtd/reply.html
...
<div class="card-body">
<h4 class="card-title text-center pb-3">{% trans "Post your comment" %}</h4>
{% include "comments/form.html" %}
</div>
...
问:我真的没有看到将回复与现有评论相关联的实现,换句话说,回复的thread_id
, parent_id
,level
被相应地赋予了值。我有没有忽略什么?
为什么我要挖掘这是因为我想对其进行一些自定义,以便单击回复不会将用户重定向到另一个 URL,而是在回复按钮下方打开评论对话框,然后用户输入评论并直接单击“发送” .
解决方案
推荐阅读
- reactjs - 将项目添加到列表后如何避免重新渲染?
- perl - Perl:如何从 csv 中删除分号
- python - 带有图像的按钮仅在*存在*错误时显示
- python - 如何将 API 响应作为参数传递给 python 中的 XML 元素?
- class - 将对象添加到继承类列表的有效方法
- postgresql - 数据库计算与前端计算的优缺点
- maven - 使用来自 Maven 本地依赖项的类 - 我错过了什么?
- javascript - 有没有更好的方法将 CSV 转换为 JSON?
- excel - VBA 编码 - 像 Power Query 这样的反透视数据
- kubernetes - Kubernetes 多状态集 pods 通信