I'd like to add django-pagedown
to my site's blog. I have a site, and an application called blog, built with Django, and I've implemented the built-in comments. These work just fine but I'm now trying to get django-pagedown
to work in the comments. For example, if a user comments on one of my articles, I would like to be able to support markdown so users could comment with code snippets or formatting without using HTML (which I probably don't want to support).
I installed django-pagedown successfully with pip:
pip install django-pagedown
I added it to my INSTALLED_APPS
section in settings.py
and collected static files:
INSTALLED_APPS = (
...
'pagedown',
...
)
python manage.py collectstatic
Something happened, because when I added this code to my blog/admin.py
file the admin post preview window appeared:
...
from pagedown.widgets import PagedownWidget, AdminPagedownWidget
from django.db import models
....
class PostAdmin(admin.ModelAdmin):
...
formfield_overrides = {
models.TextField: {'widget': AdminPagedownWidget },
}
...
Since I'm not very familiar with Django yet, the docs at:
https://github.com/timmyomahony/django-pagedown
aren't enough for me to fully understand how it's implemented. Basically, I want to add this functionality to the user comments section in the blog.
I'd like to be able to accomplish this without making custom forms and just using the built-in comments in Django. Is this possible?
I was able to get this working but ended up going with Disqus because it has great functionality and is simple to set up and moderate.