Demo projects

There are three example projects available within django-comments-xtd’s GitHub repository.

The simple project provides non-threaded comment support to articles. It’s an only-backend project, meant as a test case of the basic features (confirmation by mail, follow-up notifications, mute link).

The custom project provides threaded comment support to articles using a new comment class that inherits from django-comments-xtd’s. The new comment model adds a title field to the XtdComment class. Find more details in Customizing django-comments-xtd.

The comp project provides comments to an Article model and a Quote model. Comments for Quotes show how to use django-comments-xtd as a pure Django backend application. However comments for Articles illustrate how to use the app in combination with the provided JavaScript plugin. The project allows nested comments and defines the maximum thread level on per app.model basis. It uses moderation, removal suggestion flag, like/dislike flags, and list of users who liked/disliked comments.

Visit the example directory within the repository in GitHub for a quick look.


The recommended way to run a demo site is within its own virtualenv:

virtualenv venv
source venv/bin/activate

Once in a new virtualenv, clone the code and cd into any of the 3 demo sites. Then run the migrate command and load the data in the fixtures directory:

git clone git://
cd django-comments-xtd/
python install
npm install
node_modules/webpack/bin/webpack.js -p
cd django_comments_xtd
django-admin compilemessages -l fi
django-admin compilemessages -l fr
django-admin compilemessages -l es
cd ../example/[simple|custom|comp]
pip install -r requirements.txt
python migrate
python loaddata ../fixtures/auth.json
python loaddata ../fixtures/sites.json
python loaddata ../fixtures/articles.json
# The **comp** example project needs quotes.json too:
python loaddata ../fixtures/quotes.json
python runserver

Example projects make use of the package django-markdown2, which in turn depends on Markdown2, to render comments using Markdown syntax.

Fixtures provide:
  • A User admin, with password admin.

  • A default Site with domain localhost:8000 so that comment confirmation URLs are ready to hit the Django development web server.

  • A couple of article objects to which the user can post comments.

By default mails are sent directly to the console using the console. EmailBackend. Comment out EMAIL_BACKEND in the settings module to send actual mails. You will need to provide working values for all EMAIL_* settings.

Simple project

The simple example project features:
  1. An Articles App, with a model Article whose instances accept comments.

  2. Confirmation by mail is required before the comment hit the database, unless COMMENTS_XTD_CONFIRM_EMAIL is set to False. Authenticated users don’t have to confirm comments.

  3. Follow up notifications via mail.

  4. Mute links to allow cancellation of follow-up notifications.

  5. No nested comments.

This example project tests the initial features provided by django-comments-xtd. Setup the project as explained above.

Some hints:
  • Log out from the admin site to post comments, otherwise they will be automatically confirmed and no email will be sent.

  • When adding new articles in the admin interface be sure to tick the box allow comments, otherwise comments won’t be allowed.

  • Send new comments with the Follow-up box ticked and a different email address. You won’t receive follow-up notifications for comments posted from the same email address the new comment is being confirmed from.

  • Click on the Mute link on the Follow-up notification email and send another comment. You will not receive further notifications.

Custom project

The custom example project extends the simple project functionality featuring:

  • Thread support up to level 2

  • A new comment class that inherits from XtdComment with a new Title field and a new form class.


Comp project

The Comp Demo implements two apps, each of which contains a model whose instances can received comments:

  • App articles with the model Article

  • App quotes with the model Quote


  1. Comments can be nested, and the maximum thread level is established to 2.

  2. Comment confirmation via mail when the users are not authenticated.

  3. Comments hit the database only after they have been confirmed.

  4. Follow up notifications via mail.

  5. Mute links to allow cancellation of follow-up notifications.

  6. Registered users can like/dislike comments and can suggest comments removal.

  7. Registered users can see the list of users that liked/disliked comments.

  8. The homepage presents the last 5 comments posted either to the

    articles.Article or the quotes.Quote model.

Threaded comments

The setting COMMENTS_XTD_MAX_THREAD_LEVEL is set to 2, meaning that comments may be threaded up to 2 levels below the the first level (internally known as level 0):

First comment (level 0)
    |-- Comment to "First comment" (level 1)
        |-- Comment to "Comment to First comment" (level 2)


By using the render_xtdcomment_tree templatetag, quote_detail.html, show the tree of comments posted. Addind the argument allow_feedback users can send like/dislike feedback. Adding the argument show_feedback allow visitors see other users like/dislike feedback. And adding allow_flagging allow users flag comments for removal.


The Last 5 Comments shown in the block at the rigght uses the templatetag render_last_xtdcomments to show the last 5 comments posted to either articles.Article or quotes.Quote instances. The templatetag receives the list of pairs app.model from which we want to gather comments and shows the given N last instances posted. The templatetag renders the template django_comments_xtd/comment.html for each comment retrieve.

JavaScript plugin

As opposed to the Quote model, the Article model receives comments via the provided JavaScript plugin. Check the JavaScript plugin page to know more.