Skip to main content

wagtail-mptt-comments

Nested, threaded comments with MPTT hierarchy, multi-layer anti-spam protection, and an AJAX bulk moderation dashboard for Wagtail CMS.

Wagtail Comments Tree Preview Wagtail Comments Form Preview

Features

  • Hierarchical Threading: Fast nested comment trees powered by django-mptt, with a configurable max nesting depth.
  • Three-Layer Spam Protection:
    • Transparent honeypot traps.
    • Form submission speed verification (blocks instant bot auto-fillers).
    • Built-in lightweight math captcha for guest commentators.
  • Author Roles & Badges: Automatically distinguishes guests, registered members, moderators, and admins based on is_staff/is_superuser and configurable moderator groups — rendered as a role badge next to each comment.
  • Theme-Aware Avatars: Uses the user's profile picture when available, or a neutral inline SVG placeholder that inherits its color via currentColor — so it stays readable on any background, light or dark, instead of a hardcoded PNG silhouette.
  • Deep Linking: Every comment gets a real id="comment-<pk>" anchor, so links like /page/#comment-42 (used after posting a reply, or shared directly) actually scroll to and highlight the right comment.
  • Reply Notifications: Optional "notify me on reply" checkbox — when someone replies to a comment, its author gets an email if they opted in.
  • Wagtail Admin Dashboard:
    • List and interactive tree moderation views.
    • AJAX bulk approval and deletion.
    • In-place admin responses, shown publicly beneath the original comment.
    • Fully theme-aware admin UI — respects Wagtail's light/dark theme instead of imposing its own palette.
  • WYSIWYG Rich Text: Integrated with django-prose-editor (bold, italics, quotes, lists, links, code blocks).
  • Ready-to-use Frontend Styles: Clean, modular CSS themed entirely through CSS custom properties (--mptt-accent, --mptt-bg, etc.) — override them from your own stylesheet to match your site's palette in a couple of lines.

Admin Moderation Dashboard Admin Moderation Dashboard Tree

Installation

pip install wagtail-mptt-comments

Add required apps to INSTALLED_APPS in your settings.py:

INSTALLED_APPS = [
    ...
    "mptt",
    "wagtail_mptt_comments",
    ...
]

Include URLs in urls.py:

from django.urls import include, path

urlpatterns = [
    ...
    path("comments/", include("wagtail_mptt_comments.urls")),
    ...
]

Run database migrations:

python manage.py migrate

Optional settings

# settings.py

# Send an email to DEFAULT_FROM_EMAIL whenever a new comment is posted.
COMMENTS_NOTIFY_ADMINS = True

# Auto-approve guest comments instead of sending them to moderation.
# Authenticated users are always auto-approved.
COMMENTS_MODERATION = True  # default: True (guests go to moderation)

# Group names whose members get the "Moderator" badge on their comments.
COMMENTS_MODERATOR_GROUPS = ["Moderators"]

SITE_NAME = "My Site"
DEFAULT_FROM_EMAIL = "noreply@example.com"

Rendering in Templates

In your page template (e.g. blog_page.html), simply load the tags and call render_comments:

{% extends "base.html" %}
{% load mptt_comment_tags %}

{% block content %}
    <h1>{{ page.title }}</h1>
    
    <!-- This tag automatically loads the CSS, the comment tree, and the reply form -->
    {% render_comments page %}
{% endblock %}

### Theming

Override the CSS custom properties from your own stylesheet (loaded *after* `comments.css`) to match your site's design — no need to touch the plugin's files:

```css
.article-container {
    --mptt-bg: #1c2226;
    --mptt-card-bg: #1c2226;
    --mptt-accent: #0e8a86;
    --mptt-accent-hover: #26b5a9;
    --mptt-text: #eaeef0;
    --mptt-border: #2c3437;
}

Wagtail Prose Editor with Image Chooser

Wagtail Image Navigator Dashboard

Case Study & Background

Read the full story behind the migration and architecture on our blog: Vs-Svet.ru / ZenWay.ru.

Metadata

Release files for wagtail-mptt-comments 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-mptt-comments 0.1.0
File Size Uploaded
wagtail_mptt_comments-0.1.0.tar.gz 44.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-mptt-comments 0.1.0
File Interpreter ABI Platform
wagtail_mptt_comments-0.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 96.4 kB

Release files / wagtail_mptt_comments-0.1.0.tar.gz

Download URL wagtail_mptt_comments-0.1.0.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
511d1381b531fddf4392ec16dbfeefbef6205a6e5897be843ebb2392f375dd1a
BLAKE2b-256 checksum
How to use checksums
ac0ed5399ad37bd9411c7538871273a94c132bd16378973132f409ccba86b71c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / wagtail_mptt_comments-0.1.0-py2.py3-none-any.whl

Download URL wagtail_mptt_comments-0.1.0-py2.py3-none-any.whl
Size 52.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ca4a474c25b21c43d494ade097fefaa97317ea68d64219537400b713857dd0c1
BLAKE2b-256 checksum
How to use checksums
65f6ed4ce206aaf9043827dd17f3d913c2c945f424ff46aa17d89267db9b3a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release history Release notifications | RSS feed

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page