Fix comments snippet admin 500
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / ci (pull_request) Successful in 1m15s
CI / pr-e2e (pull_request) Successful in 1m36s

Use an explicit Wagtail Column for pending_in_article in CommentViewSet list_display and add a regression test for /cms/snippets/comments/comment/.

Fixes #37

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mark
2026-03-03 13:21:01 +00:00
parent 6555fdc41e
commit 73b023dca2
2 changed files with 24 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import pytest
from django.test import override_settings
from apps.blog.models import ArticleIndexPage, ArticlePage
from apps.blog.tests.factories import AuthorFactory
@@ -79,3 +80,18 @@ def test_bulk_approve_action_marks_selected_pending_comments_as_approved(home_pa
assert child_updates == 0
assert pending.is_approved is True
assert approved.is_approved is True
@pytest.mark.django_db
@override_settings(ALLOWED_HOSTS=["testserver", "localhost", "127.0.0.1"])
def test_comments_snippet_index_page_loads(client, django_user_model, home_page):
admin = django_user_model.objects.create_superuser(
username="admin",
email="admin@example.com",
password="admin-pass",
)
client.force_login(admin)
response = client.get("/cms/snippets/comments/comment/")
assert response.status_code == 200