現在、フォームにエラーがある場合、django.contrib.commentsはユーザーをプレビューページに送ります。
私はブログのコンテキストでコメントを使用していますが、送信で問題が発生した場合でも、ユーザーが表示されているページにとどまるようにしたいと思います。私が知る限り、これはdjango.contrib.comments.views.comments.post_commentにハードコーディングされています。
# If there are errors or if we requested a preview show the comment
if form.errors or preview:
template_list = [
"comments/%s_%s_preview.html" % tuple(str(model._meta).split(".")),
"comments/%s_preview.html" % model._meta.app_label,
"comments/preview.html",
]
return render_to_response(
template_list, {
"comment" : form.data.get("comment", ""),
"form" : form,
"next": next,
},
RequestContext(request, {})
)
ソースコードをdjango.contrib.commentsに変更せずにこの動作を変更できる方法はありますか?
任意のポインタをいただければ幸いです...
ありがとう!