Wire sx_content through full read/write pipeline
Model: add sx_content column to Post. Writer: accept sx_content in create_post, create_page, update_post. Routes: read sx_content from form data in new post, new page, and edit routes. Read pipeline: ghost_db includes sx_content in public dict, detail/home views prefer sx_content over html when available, PostDTO includes sx_content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,6 +63,7 @@ def _post_to_public(p: Post) -> Dict[str, Any]:
|
||||
"slug": p.slug,
|
||||
"title": p.title,
|
||||
"html": p.html,
|
||||
"sx_content": p.sx_content,
|
||||
"is_page": p.is_page,
|
||||
"excerpt": p.custom_excerpt or p.excerpt,
|
||||
"custom_excerpt": p.custom_excerpt,
|
||||
|
||||
@@ -265,6 +265,7 @@ def register(url_prefix, title):
|
||||
return await make_response(html, 400)
|
||||
|
||||
# Create directly in db_blog
|
||||
sx_content_raw = form.get("sx_content", "").strip() or None
|
||||
post = await writer_create(
|
||||
g.s,
|
||||
title=title,
|
||||
@@ -274,6 +275,7 @@ def register(url_prefix, title):
|
||||
feature_image=feature_image or None,
|
||||
custom_excerpt=custom_excerpt or None,
|
||||
feature_image_caption=feature_image_caption or None,
|
||||
sx_content=sx_content_raw,
|
||||
)
|
||||
await g.s.flush()
|
||||
|
||||
@@ -337,6 +339,7 @@ def register(url_prefix, title):
|
||||
return await make_response(html, 400)
|
||||
|
||||
# Create directly in db_blog
|
||||
sx_content_raw = form.get("sx_content", "").strip() or None
|
||||
page = await writer_create_page(
|
||||
g.s,
|
||||
title=title,
|
||||
@@ -346,6 +349,7 @@ def register(url_prefix, title):
|
||||
feature_image=feature_image or None,
|
||||
custom_excerpt=custom_excerpt or None,
|
||||
feature_image_caption=feature_image_caption or None,
|
||||
sx_content=sx_content_raw,
|
||||
)
|
||||
await g.s.flush()
|
||||
|
||||
|
||||
@@ -562,6 +562,7 @@ def register():
|
||||
elif status and status != current_status:
|
||||
effective_status = status
|
||||
|
||||
sx_content_raw = form.get("sx_content", "").strip() or None
|
||||
try:
|
||||
post = await writer_update(
|
||||
g.s,
|
||||
@@ -573,6 +574,7 @@ def register():
|
||||
custom_excerpt=custom_excerpt or None,
|
||||
feature_image_caption=feature_image_caption or None,
|
||||
status=effective_status,
|
||||
sx_content=sx_content_raw,
|
||||
)
|
||||
except OptimisticLockError:
|
||||
return redirect(
|
||||
|
||||
Reference in New Issue
Block a user