fix(editor): remove SEO panel duplication and auto-default draft metadata #54

Merged
mark merged 2 commits from fix/article-editor-defaults into main 2026-03-04 22:47:21 +00:00
Owner

Closes #53.

What Changed

  • Added ArticlePageAdminForm to make article draft creation resilient when writers omit metadata fields.
  • Removed duplicated SEO/promote panel composition in the article editor.
  • Added model-level summary fallback on save for non-form code paths.
  • Added regression tests for defaults + SEO panel de-duplication.

Details

Editor defaults (apps/blog/models.py)

  • New ArticlePageAdminForm(WagtailAdminPageForm) now:
    • marks slug, author, category, and summary as non-required at initial form-validation stage
    • auto-generates slug from title (with sibling-safe uniqueness under parent page)
    • defaults author to the current editor's linked Author record
    • auto-creates an Author record linked to the current user if missing
    • defaults category to general (creating it if missing)
    • auto-generates summary from prose body blocks (excluding code blocks)
  • ArticlePage.base_form_class = ArticlePageAdminForm is now set.

SEO tab de-duplication (apps/blog/models.py)

  • Changed SEO tab composition from:
    • Page.promote_panels + SeoMixin.seo_panels
  • to:
    • SeoMixin.seo_panels
  • This removes duplicate rendering of overlapping fields (slug, seo_title, search_description, show_in_menus).

Save fallback (apps/blog/models.py)

  • Added _generate_summary_from_stream(...) helper.
  • ArticlePage.save() now auto-populates summary from body prose (or title fallback) if blank.

Tests Added / Updated

apps/blog/tests/test_admin_experience.py:

  • test_article_admin_form_relaxes_initial_required_fields
  • test_article_admin_form_clean_applies_defaults
  • test_article_seo_tab_fields_not_duplicated
  • test_article_save_autogenerates_summary_when_missing

Validation Run

  • docker compose run --rm web ruff check apps/blog/models.py apps/blog/tests/test_admin_experience.py
  • docker compose run --rm web pytest --no-cov apps/blog/tests/test_admin_experience.py -q
  • docker compose run --rm web pytest --no-cov apps/blog/tests -q
Closes #53. ## What Changed - Added `ArticlePageAdminForm` to make article draft creation resilient when writers omit metadata fields. - Removed duplicated SEO/promote panel composition in the article editor. - Added model-level summary fallback on save for non-form code paths. - Added regression tests for defaults + SEO panel de-duplication. ## Details ### Editor defaults (`apps/blog/models.py`) - New `ArticlePageAdminForm(WagtailAdminPageForm)` now: - marks `slug`, `author`, `category`, and `summary` as non-required at initial form-validation stage - auto-generates `slug` from title (with sibling-safe uniqueness under parent page) - defaults `author` to the current editor's linked `Author` record - auto-creates an `Author` record linked to the current user if missing - defaults `category` to `general` (creating it if missing) - auto-generates `summary` from prose body blocks (excluding code blocks) - `ArticlePage.base_form_class = ArticlePageAdminForm` is now set. ### SEO tab de-duplication (`apps/blog/models.py`) - Changed SEO tab composition from: - `Page.promote_panels + SeoMixin.seo_panels` - to: - `SeoMixin.seo_panels` - This removes duplicate rendering of overlapping fields (`slug`, `seo_title`, `search_description`, `show_in_menus`). ### Save fallback (`apps/blog/models.py`) - Added `_generate_summary_from_stream(...)` helper. - `ArticlePage.save()` now auto-populates `summary` from body prose (or title fallback) if blank. ## Tests Added / Updated `apps/blog/tests/test_admin_experience.py`: - `test_article_admin_form_relaxes_initial_required_fields` - `test_article_admin_form_clean_applies_defaults` - `test_article_seo_tab_fields_not_duplicated` - `test_article_save_autogenerates_summary_when_missing` ## Validation Run - `docker compose run --rm web ruff check apps/blog/models.py apps/blog/tests/test_admin_experience.py` - `docker compose run --rm web pytest --no-cov apps/blog/tests/test_admin_experience.py -q` - `docker compose run --rm web pytest --no-cov apps/blog/tests -q`
codex_a added 1 commit 2026-03-04 22:32:24 +00:00
fix(editor): auto-default article metadata and de-duplicate SEO panels
Some checks failed
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / ci (pull_request) Failing after 1m33s
CI / pr-e2e (pull_request) Successful in 1m35s
521075cf04
codex_a added 1 commit 2026-03-04 22:42:36 +00:00
test(core): keep blank-summary integrity check by bypassing auto-summary save hook
All checks were successful
CI / nightly-e2e (pull_request) Has been skipped
CI / deploy (pull_request) Has been skipped
CI / pr-e2e (pull_request) Successful in 1m29s
CI / ci (pull_request) Successful in 1m40s
2c2cb5446f
mark merged commit 59cc1c41a9 into main 2026-03-04 22:47:21 +00:00
mark deleted branch fix/article-editor-defaults 2026-03-04 22:47:21 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nohype/main-site#54