Fix admin message auto-dismiss and Category plural label
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 1m47s
CI / pr-e2e (pull_request) Successful in 1m46s

Admin messages now auto-clear after 8 seconds via the w-messages
Stimulus controller's autoClear value, preventing message pile-up.
Category model gains verbose_name_plural so Wagtail shows "Categories"
instead of "Categorys" in the snippets menu.

Closes #62

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 00:13:00 +00:00
parent e75dda84ef
commit 6ab6c3c0bf
5 changed files with 62 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
# Generated by Django 5.2.12 on 2026-03-19 00:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_backfill_published_date'),
]
operations = [
migrations.AlterModelOptions(
name='category',
options={'ordering': ['sort_order', 'name'], 'verbose_name_plural': 'categories'},
),
]

View File

@@ -168,6 +168,7 @@ class Category(models.Model):
class Meta:
ordering = ["sort_order", "name"]
verbose_name_plural = "categories"
def __str__(self):
return self.name

View File

@@ -386,6 +386,31 @@ def test_article_save_autogenerates_summary_when_missing(article_index):
assert article.summary == "This should become the summary text."
@pytest.mark.django_db
def test_category_verbose_name_plural():
"""Category Meta should define verbose_name_plural as 'categories'."""
assert Category._meta.verbose_name_plural == "categories"
@pytest.mark.django_db
@override_settings(ALLOWED_HOSTS=["testserver", "localhost", "127.0.0.1"])
def test_snippet_category_listing_shows_categories(client, django_user_model):
"""Categories created in the database should appear in the Snippets listing."""
Category.objects.create(name="Reviews", slug="reviews")
Category.objects.create(name="Tutorials", slug="tutorials")
admin = django_user_model.objects.create_superuser(
username="admin-cat", email="admin-cat@example.com", password="admin-pass"
)
client.force_login(admin)
response = client.get("/cms/snippets/blog/category/")
content = response.content.decode()
assert response.status_code == 200
assert "Reviews" in content
assert "Tutorials" in content
@pytest.mark.django_db
def test_article_page_omits_admin_messages_on_frontend(article_page, rf):
"""Frontend templates should not render admin session messages."""