fix(editor): remove SEO panel duplication and auto-default draft metadata #54
Reference in New Issue
Block a user
Delete Branch "fix/article-editor-defaults"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #53.
What Changed
ArticlePageAdminFormto make article draft creation resilient when writers omit metadata fields.Details
Editor defaults (
apps/blog/models.py)ArticlePageAdminForm(WagtailAdminPageForm)now:slug,author,category, andsummaryas non-required at initial form-validation stageslugfrom title (with sibling-safe uniqueness under parent page)authorto the current editor's linkedAuthorrecordAuthorrecord linked to the current user if missingcategorytogeneral(creating it if missing)summaryfrom prose body blocks (excluding code blocks)ArticlePage.base_form_class = ArticlePageAdminFormis now set.SEO tab de-duplication (
apps/blog/models.py)Page.promote_panels + SeoMixin.seo_panelsSeoMixin.seo_panelsslug,seo_title,search_description,show_in_menus).Save fallback (
apps/blog/models.py)_generate_summary_from_stream(...)helper.ArticlePage.save()now auto-populatessummaryfrom body prose (or title fallback) if blank.Tests Added / Updated
apps/blog/tests/test_admin_experience.py:test_article_admin_form_relaxes_initial_required_fieldstest_article_admin_form_clean_applies_defaultstest_article_seo_tab_fields_not_duplicatedtest_article_save_autogenerates_summary_when_missingValidation Run
docker compose run --rm web ruff check apps/blog/models.py apps/blog/tests/test_admin_experience.pydocker compose run --rm web pytest --no-cov apps/blog/tests/test_admin_experience.py -qdocker compose run --rm web pytest --no-cov apps/blog/tests -q