Skip to content
Advertisement

How to add a comment to post? PostDetailVew, Django 2.1.5

I want add comment to post on his page (“post detail” page).

I was find answer, but it create comment on other page. I want create comment on page of “post detail”.

urls.py

JavaScript

models.py

JavaScript

forms.py

JavaScript

views.py

JavaScript

comment_form.html

JavaScript

post_detail.html

JavaScript

I think, “comment_form” need to redirect to “post_detail”, not generate new page for comment form.

And сould you tell, which parameters has a RichTextField (CKE), how change width, height field only in comment?

Advertisement

Answer

If you want the comment form right in your detail page then all you have to do is to add the form and post function in your View,

JavaScript

And now you can add your form in your html. And add a submit button to post comment.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement