Adding django-pagedown to Django 1.5 Blog Comments -
i'd add django-pagedown
site's blog. have site, , application called blog, built django, , i've implemented built-in comments. these work fine i'm trying django-pagedown
work in comments. example, if user comments on 1 of articles, able support markdown users comment code snippets or formatting without using html (which don't want support).
i installed django-pagedown pip:
pip install django-pagedown
i added installed_apps
section in settings.py
, collected static files:
installed_apps = ( ... 'pagedown', ... )
python manage.py collectstatic
something happened, because when added code blog/admin.py
file admin post preview window appeared:
... pagedown.widgets import pagedownwidget, adminpagedownwidget django.db import models .... class postadmin(admin.modeladmin): ... formfield_overrides = { models.textfield: {'widget': adminpagedownwidget }, } ...
since i'm not familiar django yet, docs at:
https://github.com/timmyomahony/django-pagedown
aren't enough me understand how it's implemented. basically, want add functionality user comments section in blog.
i'd able accomplish without making custom forms , using built-in comments in django. possible?
i able working ended going disqus because has great functionality , simple set , moderate.
first, consider whether want use django.contrib.comments
; it's being deprecated in version 1.6 , no longer supported after that. see discussion here.
if want use it, you're going have customize comments app. documentation lays out need do. in forms.py
you'll have this:
from pagedown.widgets import pagedownwidget django.contrib.comments.forms import commentform django.forms import charfield class pagedowncommentform(commentform): comment = charfield(widget=pagedownwidget())
you'll need put get_form()
function in new app's __init__.py
, , make other changes described in docs.
hopefully give idea of how proceed.
Comments
Post a Comment