Compare commits
2 Commits
v0.3
...
83ec86b027
| Author | SHA1 | Date | |
|---|---|---|---|
| 83ec86b027 | |||
| 726767c950 |
10
app/main.py
10
app/main.py
@@ -26,17 +26,25 @@ templates = Jinja2Templates(directory="app/templates")
|
|||||||
@api_router.get("/")
|
@api_router.get("/")
|
||||||
def index(request: Request):
|
def index(request: Request):
|
||||||
reg_open, not_before, not_after = is_registration_open()
|
reg_open, not_before, not_after = is_registration_open()
|
||||||
|
print(reg_open, not_before, not_after)
|
||||||
if reg_open:
|
if reg_open:
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
request=request, name="registration-open.html", context={}
|
request=request, name="registration-open.html", context={}
|
||||||
)
|
)
|
||||||
else:
|
elif not_before:
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
request=request, name="registration-closed.html", context={
|
request=request, name="registration-closed.html", context={
|
||||||
"not_before": settings.NOT_BEFORE,
|
"not_before": settings.NOT_BEFORE,
|
||||||
"not_after": settings.NOT_AFTER,
|
"not_after": settings.NOT_AFTER,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
elif not_after:
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
request=request, name="registration-not-open.html", context={
|
||||||
|
"not_before": settings.NOT_BEFORE,
|
||||||
|
"not_after": settings.NOT_AFTER,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
@api_router.get("/success.html")
|
@api_router.get("/success.html")
|
||||||
def success(request: Request):
|
def success(request: Request):
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ from datetime import date, datetime
|
|||||||
|
|
||||||
from sqlalchemy.sql import func
|
from sqlalchemy.sql import func
|
||||||
|
|
||||||
|
from app.core.config import settings
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
class VoiceEnum(str, Enum):
|
class VoiceEnum(str, Enum):
|
||||||
base = "Bass"
|
base = "Bass"
|
||||||
@@ -42,4 +45,5 @@ class RegistrationCreate(RegistrationBase):
|
|||||||
|
|
||||||
class Registration(RegistrationBase, table=True):
|
class Registration(RegistrationBase, table=True):
|
||||||
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
||||||
timestamp: datetime = Field(default_factory=func.now)
|
timestamp: datetime = Field(default_factory=lambda : datetime.now(tz=settings.TZ))
|
||||||
|
|
||||||
|
|||||||
0
app/static/styles.css
Normal file
0
app/static/styles.css
Normal file
@@ -5,7 +5,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
Die Anmeldung ist leider noch nicht geöffnet. Sie öffnet am {{ not_before }} und schließt am {{ not_after }}.
|
Die Anmeldung ist leider bereits geschlossen. Folge uns, um vom nächsten Anmeldezeitraum zu erfahren.
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
11
app/templates/registration-not-open.html
Normal file
11
app/templates/registration-not-open.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Choriosity Anmeldung</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
Die Anmeldung ist noch nicht geöffnet. Sie öffnet {{ not_before.strftime('am %d.%m.%Y um %H:%M Uhr') }} und schließt {{ not_after.strftime('am %d.%m.%Y um %H:%M Uhr') }}.
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user