feat: 新增隐私政策内容页(apps.core.SimpleContentPage)及seed命令,更新设计文档

This commit is contained in:
2026-08-06 17:17:07 +08:00
parent 9e60cabd5e
commit b05d2b7f52
9 changed files with 173 additions and 3 deletions
+15
View File
@@ -2,6 +2,7 @@
import pytest
from apps.core.blocks import FormBlock
from apps.core.models import SimpleContentPage
from apps.forms.models import FormDefinition, FormDefinitionField
pytestmark = pytest.mark.django_db
@@ -60,3 +61,17 @@ def test_form_block_api_representation_handles_empty_form():
block = FormBlock()
result = block.get_api_representation({"form": None})
assert result == {"form": None}
def test_simple_content_page_can_be_created_under_home(home_page):
"""隐私政策等法务页面应可作为 HomePage 的子页面创建,并保留富文本内容。"""
page = SimpleContentPage(
title="隐私政策",
slug="privacy-policy",
body="<p>我们重视您的个人信息保护。</p>",
)
home_page.add_child(instance=page)
page.refresh_from_db()
assert SimpleContentPage.objects.live().descendant_of(home_page).count() == 1
assert "个人信息保护" in page.body