feat: 初始版本,圆角主题与首次管理员引导

This commit is contained in:
2025-12-07 10:53:52 +08:00
commit 63db6a0815
43 changed files with 1293 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
from flask import Blueprint, request, redirect, url_for
from flask_login import login_required, current_user
from ..extensions import db
from ..models import Comment, Post
bp = Blueprint("comments", __name__, url_prefix="/comments")
@bp.route("/create/<int:post_id>", methods=["POST"])
@login_required
def create(post_id):
post = Post.query.get_or_404(post_id)
body = request.form.get("body")
if body:
c = Comment(post_id=post.id, user_id=current_user.id, body=body)
db.session.add(c)
db.session.commit()
return redirect(url_for("posts.detail", post_id=post.id))