{#
Shared create + edit form for posts.
Context:
- user : app.models.entities.User
- post : app.models.entities.Post | None (None on create)
- form : dict {title, body_md, status}
- errors : dict {field_name: message}
- csrf_token : str
Status dropdown policy:
- On create: draft is default, admin may pick published.
- On edit: status is read-only here — use the toggle-publish
button on the dashboard. Keeps the write path explicit.
#}
{% extends "admin/base.html" %}
{% block title %}
{% if post %}Edit post{% else %}New post{% endif %} — Admin
{% endblock %}
{% block content %}
{% if post %}Edit post{% else %}New post{% endif %}
{% if post %}
Slug: {{ post.slug }}
{% if post.status.value == "published" %}
· slug is locked because this post is published.
{% endif %}
{% endif %}
{% if errors %}
{% for field, msg in errors.items() %}
{{ msg }}
{% endfor %}