Django-comments-xtd comes with two demo projects to see the app in action:
- The Simple Model Demo Site
- The Multiple Model Demo Site
The Simple Demo Site provides the minimum stuff to use django-comments-xtd. It consists of an app called articles with an Article model. Instances of Article accept comments.
The Multiple Demo Site is a website that allows the user to post comments to three different type of instances: stories, quotes, and project releases. Stories and quotes belong to the blog app and project releases belong to the projects app. The demo shows the blog homepage with the last 5 comments posted to either stories or quotes and a link to the complete paginated list of comments.
These two demo projects are examples of how to use the built-in Django Comments Framework with Django-comments-xtd.
- Logged out, to receive confirmation requests by email
- Logged in, to get your comments accepted without requiring confirmation
- The Blog contains Stories and Quotes. Instances of both models have comments. The blog index page shows the last 5 comments posted to either stories or quotes. It also gives access to the complete paginated list of comments.
- Project releases have comments as well but are not included in the complete paginated list of comments shown in the blog.
- The templatetag {% render_last_xtdcomments 5 for blog.story blog.quote %}
- And the following template files from the demos/multiple/templates directory:
- django_comments_xtd/blog/story/comment.html to render comments posted to stories
- django_comments_xtd/blog/quote/comment.html to render comments posted to quotes
- You may rather use a common template to render comments:
- For all blog app models: django_comments_xtd/blog/comment.html
- For all the website models: django_comments_xtd/comment.html
- An instance of a generic ListView class declared in blog/urls.py that uses the following queryset:
- XtdComment.objects.for_app_models("blog.story", "blog.quote")
- To format and render a comment in a markup language, make sure the first line of the comment looks like: #!<markup-language> being <markup-language> any of the following options:
- markdown
- restructuredtext
- linebreaks
- Then use the filter render_markup_comment with the comment field in your template to interpret the content (see demos/multiple/templates/comments/list.html).