[Answered ]-How to add markdown editor to custom django comment?

2👍

You need to write a custom form for your Comment model

comments/forms.py

from django_markdown.widgets import MarkdownWidget
...
class CommentForm(forms.Form):
    body = forms.CharField( widget=MarkdownWidget() )

The markdown widget handles adding the necessary js and css for the editor to the page, assuming you are not explicitly defining your resources in your template, but your form or view will need to associate the comment with the right post and user.

On the display side, you will need to use the markdown templatetag when displaying your comments

comments/templates/comment.html

{% load django_markdown %}
...
{{ comment.author }} //etc
{{ comment.body|markdown }}
👤Enrico

Leave a comment