From 109ca94ef785e9a677263a5497f5a162896d4273 Mon Sep 17 00:00:00 2001 From: Meera-Persad Date: Mon, 2 Mar 2026 17:37:11 -0400 Subject: [PATCH 1/2] added print("save") --- app/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/main.py b/app/main.py index fbb3730..8723adc 100644 --- a/app/main.py +++ b/app/main.py @@ -35,4 +35,5 @@ async def unauthorized_redirect_handler(request: Request, exc: Exception): if __name__ == "__main__": + print("Save") uvicorn.run("app.main:app", host=get_settings().app_host, port=get_settings().app_port, reload=get_settings().env.lower()!="production") From 993d637a64f88ad22f2ee94892ee8a05090b85c5 Mon Sep 17 00:00:00 2001 From: Meera-Persad Date: Mon, 9 Mar 2026 16:09:27 -0400 Subject: [PATCH 2/2] lab7render-updated --- app/main.py | 1 + app/routers/app.py | 16 ++++++++++++++ app/templates/authenticated-base.html | 6 ++++- app/templates/todos.html | 32 +++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 app/templates/todos.html diff --git a/app/main.py b/app/main.py index 8723adc..25dcba0 100644 --- a/app/main.py +++ b/app/main.py @@ -36,4 +36,5 @@ async def unauthorized_redirect_handler(request: Request, exc: Exception): if __name__ == "__main__": print("Save") + print ("This is ") uvicorn.run("app.main:app", host=get_settings().app_host, port=get_settings().app_port, reload=get_settings().env.lower()!="production") diff --git a/app/routers/app.py b/app/routers/app.py index 28236fe..3e30d86 100644 --- a/app/routers/app.py +++ b/app/routers/app.py @@ -23,4 +23,20 @@ async def app( context={ "user": user } + ) + +@app_router.get("/todos", response_class=HTMLResponse) +async def get_todos( + request: Request, + user: AuthDep, #get currently logged in user + db:SessionDep +): + todos = db.exec(select(Todo).where(Todo).user_id == user.id).all() + return templates.TemplateResponse( + request=request, + name="todos.html", + context={ + "user":user, + "todos":todos + } ) \ No newline at end of file diff --git a/app/templates/authenticated-base.html b/app/templates/authenticated-base.html index a3d569a..434eff0 100644 --- a/app/templates/authenticated-base.html +++ b/app/templates/authenticated-base.html @@ -79,9 +79,13 @@

Project Template

diff --git a/app/templates/todos.html b/app/templates/todos.html new file mode 100644 index 0000000..9618cd9 --- /dev/null +++ b/app/templates/todos.html @@ -0,0 +1,32 @@ +{% extends "authenticated-base.html" %} + +{% block subpage_content %} + +

My Todos

+ +{% if todos %} + + + + + + + + + + + {% for todo in todos %} + + + + + {% end for %} + +
IDTodo task
{{todo.id}}{{todo.title}}
+ +{% else %} +

No Todos found.

+ +{% endif %} + +{% endblock %} \ No newline at end of file