From 112459964a695b66acda411baf07fcd5d10abbe7 Mon Sep 17 00:00:00 2001 From: Niklas Meinzer Date: Thu, 9 Oct 2025 12:15:46 +0200 Subject: [PATCH] Minor tweaks * display date on event page * Filter existing subscriptions for new subscriptions dropdown * Add Typeahead for Team registration --- new-registration-app/main.py | 15 ++++++--------- new-registration-app/pyproject.toml | 2 ++ new-registration-app/templates/add_event.html | 1 - new-registration-app/templates/event.html | 12 ++++++++++-- new-registration-app/templates/subscribe.html | 1 - 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/new-registration-app/main.py b/new-registration-app/main.py index af5d904..c3bd015 100644 --- a/new-registration-app/main.py +++ b/new-registration-app/main.py @@ -10,8 +10,7 @@ from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from sqlmodel import Session, SQLModel, create_engine, select -from models import (Event, Household, Registration, Subscription, - TeamRegistration) +from models import Event, Household, Registration, Subscription, TeamRegistration sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" @@ -85,15 +84,13 @@ async def subscribe(request: Request, session: SessionDep): statement = select(Household) households = session.exec(statement).all() - # filter out households with existing registrations - # households = [ - # h - # for h in households - # if h.id not in [reg.household_id for reg in event.registrations] - # ] - subscriptions = session.exec(select(Subscription)).all() + # filter out households with existing subscriptions + households = [ + h for h in households if h.id not in [sub.household_id for sub in subscriptions] + ] + return templates.TemplateResponse( request=request, name="subscribe.html", diff --git a/new-registration-app/pyproject.toml b/new-registration-app/pyproject.toml index f7bdbd8..9bbeba7 100644 --- a/new-registration-app/pyproject.toml +++ b/new-registration-app/pyproject.toml @@ -15,3 +15,5 @@ dev = [ "black>=25.1.0", "isort>=6.0.1", ] +[tool.isort] +profile = "black" \ No newline at end of file diff --git a/new-registration-app/templates/add_event.html b/new-registration-app/templates/add_event.html index 5a9ad64..201ccdd 100644 --- a/new-registration-app/templates/add_event.html +++ b/new-registration-app/templates/add_event.html @@ -32,7 +32,6 @@ - Abbrechen diff --git a/new-registration-app/templates/event.html b/new-registration-app/templates/event.html index 05517d2..395ba8d 100644 --- a/new-registration-app/templates/event.html +++ b/new-registration-app/templates/event.html @@ -14,10 +14,11 @@ {% extends "base.html" %} {% block content %}

{{ event.title }}

+

{{ event.event_time.strftime('%A, %d.%m.%Y') }}

{{ event.description }}


-

Anmeldungen

+

Anmeldungen

Anmeldung schließt {{ event.registration_deadline.strftime('%A, %d.%m.%Y, %H:%M Uhr') }}

@@ -214,8 +215,15 @@
+ aria-label="Name" list="people">
+ + {% for household in households %} + {% for person in household.name.split(",") %} +