add comic artist details page

This commit is contained in:
Thomas Peetz
2025-04-27 14:52:07 +02:00
parent 8ec0784490
commit f5f673fd4e
4 changed files with 54 additions and 4 deletions
+1 -1
View File
@@ -51,5 +51,5 @@ ENV PATH="/app/.venv/bin:$PATH"
EXPOSE $PORT
# Start the application with Uvicorn in production mode, using environment variable references
CMD ["uvicorn", "src.main:app", "--log-level", "info", "--host", "0.0.0.0" , "--port", "8800"]
CMD ["uvicorn", "src.main:kontor", "--log-level", "info", "--host", "0.0.0.0" , "--port", "8800"]
@@ -0,0 +1,45 @@
{% extends "shared/base.html" %}
{% block title %}
<title>Comic Detail</title>
{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col">
<h1 class="display-5">Comic Detail</h1>
</div>
</div>
<div class="row">
<table class="table table-striped table-hover">
<tbody>
<tr>
<th scope="row">Artist Name</th>
<td colspan="2">{{artist.name}}</td>
</tr>
<tr>
<th scope="row">Works</th>
<td colspan="2">
{% for work in artist.comic_works %}
<p>
{{work.work_type.name}}: <a href="/comic/comics/{{work.comic.id}}">{{work.comic.title}}</a>
</p>
{% endfor %}
</td>
</tr>
<tr>
<th scope="row">Data Created</th>
<td colspan="2">{{artist.created_date}}</td>
</tr>
<tr>
<th scope="row">Data Modified</th>
<td colspan="2">{{artist.last_modified_date}}</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}
@@ -22,7 +22,7 @@
</tr>
<tr>
<th scope="row">Publisher</th>
<td colspan="2"><a href="/comics/publishers/{{comic.publisher.id}}">{{comic.publisher.name}}</a></td>
<td colspan="2"><a href="/comic/publishers/{{comic.publisher.id}}">{{comic.publisher.name}}</a></td>
</tr>
<tr>
<th scope="row">Completed</th>
@@ -33,7 +33,7 @@
<td colspan="2">
{% for work in comic.comic_works %}
<p>
{{work.work_type.name}}: <a href="/comics/artists/{{work.artist.id}}">{{work.artist.name}}</a>
{{work.work_type.name}}: <a href="/comic/artists/{{work.artist.id}}">{{work.artist.name}}</a>
</p>
{% endfor %}
</td>
+6 -1
View File
@@ -18,9 +18,14 @@ def get_comics(db: SessionDep, request: Request, msg: str = None):
@router.get("/comics/{comic_id}")
def comic_details(comic_id: UUID, request: Request, db: SessionDep):
comic = db.get(Comic, comic_id)
return templates.TemplateResponse("comic/detail.html", {"request": request, "comic":comic})
return templates.TemplateResponse("comic/comic_detail.html", {"request": request, "comic":comic})
@router.get("/artists")
def get_artists(db: SessionDep, request: Request, msg: str = None):
artists = db.query(Artist).all()
return templates.TemplateResponse("comic/artists.html", {"request": request, "msg": msg, "artists": artists})
@router.get("/artists/{artist_id}")
def artist_detail(artist_id: UUID, request: Request, db: SessionDep):
artist = db.get(Artist, artist_id)
return templates.TemplateResponse("comic/artist_detail.html", {"request": request, "artist": artist})