fix admin template collision with auth/dashboard blueprints
Namespace admin templates under admin/ subdirectory to prevent Quart's template loader from resolving auth's login.html and dashboard's index.html instead of admin's own templates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -189,7 +189,7 @@ async def login():
|
|||||||
else:
|
else:
|
||||||
await flash("Invalid password.", "error")
|
await flash("Invalid password.", "error")
|
||||||
|
|
||||||
return await render_template("login.html")
|
return await render_template("admin/login.html")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/logout", methods=["POST"])
|
@bp.route("/logout", methods=["POST"])
|
||||||
@@ -210,7 +210,7 @@ async def index():
|
|||||||
failed_tasks = await get_failed_tasks()
|
failed_tasks = await get_failed_tasks()
|
||||||
|
|
||||||
return await render_template(
|
return await render_template(
|
||||||
"index.html",
|
"admin/index.html",
|
||||||
stats=stats,
|
stats=stats,
|
||||||
recent_users=recent_users,
|
recent_users=recent_users,
|
||||||
failed_tasks=failed_tasks,
|
failed_tasks=failed_tasks,
|
||||||
@@ -229,7 +229,7 @@ async def users():
|
|||||||
user_list = await get_users(limit=per_page, offset=offset, search=search or None)
|
user_list = await get_users(limit=per_page, offset=offset, search=search or None)
|
||||||
|
|
||||||
return await render_template(
|
return await render_template(
|
||||||
"users.html",
|
"admin/users.html",
|
||||||
users=user_list,
|
users=user_list,
|
||||||
search=search,
|
search=search,
|
||||||
page=page,
|
page=page,
|
||||||
@@ -245,7 +245,7 @@ async def user_detail(user_id: int):
|
|||||||
await flash("User not found.", "error")
|
await flash("User not found.", "error")
|
||||||
return redirect(url_for("admin.users"))
|
return redirect(url_for("admin.users"))
|
||||||
|
|
||||||
return await render_template("user_detail.html", user=user)
|
return await render_template("admin/user_detail.html", user=user)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/users/<int:user_id>/impersonate", methods=["POST"])
|
@bp.route("/users/<int:user_id>/impersonate", methods=["POST"])
|
||||||
@@ -284,7 +284,7 @@ async def tasks():
|
|||||||
failed = await get_failed_tasks()
|
failed = await get_failed_tasks()
|
||||||
|
|
||||||
return await render_template(
|
return await render_template(
|
||||||
"tasks.html",
|
"admin/tasks.html",
|
||||||
tasks=task_list,
|
tasks=task_list,
|
||||||
failed_tasks=failed,
|
failed_tasks=failed,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user