문제

I'm using the stock Django comments framework. What's the best way to add a checkbox to the comment form to allow commenters to be notified of future comments?

도움이 되었습니까?

해결책

This isn't built into the django comment framework so you have to do it yourself.

You could subclass the Comment model to include a boolean field that tracks whether or not the commenter want's to be notified on that comment, then wrap the post_comment view to detect this settings - for every new comment that is made, collect all the other comments for that object and create a list of the users that want to be notified, then use django-notifications or similar to actually send the notifictions.

On the frontend you simply need to overwrite the templates/comments/form.html to include your new field so that should be easy enough.

This is too high level to give any code samples, so you'll have to work on it yourself and come back when there are problems.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top