# Building a powerful comment system

DevFeed: [Building a powerful comment system](<https://devfeed.tech/articles/building-a-powerful-comment-system-19994.md>)

Original publisher: [Read original article](<http://engineering.hackerearth.com/2015/01/27/making-comments-more-powerful/>)

Published: 2015-01-27T00:00:00Z

Content type: article

Language: en

Sources: [HackerEarth](<https://devfeed.tech/sources/hackerearth.md>)

Topics: [Giscus](<https://devfeed.tech/topics/giscus.md>), [Ajax](<https://devfeed.tech/topics/ajax.md>), [Website](<https://devfeed.tech/topics/website.md>), [User Experience](<https://devfeed.tech/topics/user-experience.md>)

Tags: [ajax](<https://devfeed.tech/tags/ajax.md>), [app](<https://devfeed.tech/tags/app.md>), [building](<https://devfeed.tech/tags/building.md>), [challenges](<https://devfeed.tech/tags/challenges.md>), [comment](<https://devfeed.tech/tags/comment.md>), [display](<https://devfeed.tech/tags/display.md>), [django](<https://devfeed.tech/tags/django.md>), [form](<https://devfeed.tech/tags/form.md>), [include](<https://devfeed.tech/tags/include.md>), [integrate](<https://devfeed.tech/tags/integrate.md>), [lets](<https://devfeed.tech/tags/lets.md>), [list](<https://devfeed.tech/tags/list.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [override](<https://devfeed.tech/tags/override.md>), [pages](<https://devfeed.tech/tags/pages.md>), [people](<https://devfeed.tech/tags/people.md>), [plug](<https://devfeed.tech/tags/plug.md>), [powerful](<https://devfeed.tech/tags/powerful.md>), [realtime](<https://devfeed.tech/tags/realtime.md>), [system](<https://devfeed.tech/tags/system.md>)

## AI overview

The system extends Django's django-threadedcomments with a reusable layer that embeds comment lists and reply forms in templates and allows page-specific display logic. AJAX handles comment actions; deletion uses breadth-first traversal and checks for undeleted children to decide whether to retain a deleted comment or remove its thread. For realtime updates, the team was experimenting with Pusher through RabbitMQ, noting that Pusher's presence system made tracking more than 100 clients difficult and limited complex client-side logic. Users can tag people with @ mentions; the backend queries a graph search database and sends email notifications.

## Source excerpt

In this post, I am going to briefly descibe the challenges we faced while building a powerful comment system. Comments have become an integral part of our website. They are integrated almost everywhere - challenges, problems, notes etc. and soon will be added to our new products. We have been working to make it more powerful and usable. Here is what we did: Pluggable architecture Ajaxifying comments Realtime sync Tagging people From the beginning Our comment system is built using an open source django app, named django-threadedcomments. In threadedcomments, commenters can reply both to the original item, and reply to other comments as well. This open source app best suited our requirements in terms of UX, hence we decided to use it. But later we realised it was not powerful enough, and we decided to add our own features in it. Pluggable architecture Our commmenting system is a plug and play app. We added a layer on top of django-threadedcommnets which lets us integrate comments anywhere on our website easily without writing the same code again. Below is the snippet which we can include in any django template to add comments. <div id="comments-{{model.get_content_type.id}}-{{model.id}}" class="pagelet-inview standard-margin comments" ajax="{% url render_comments model.id model.get_content_type.id %}" target="comments-{{model.get_content_type.id}}-{{model.id}}"></div> Above single line of code renders complete comment list(including reply form) using bigpipe. Isn't it cool? One more reason I am calling our comment system plug and play is that we can easily override most of the comments display logic, show comments differently on different pages. For example, comments appearing on a note and problem page needs to be shown differently based on the logic 'who is the moderator of the content'. This couldn't have been possible without django template block tag. comments/base/list.html <!-- This blocks handles logic to determine if user is a normal user or a moderator --> {