Add max_days query parameter

This commit is contained in:
Fabian Müller 2022-11-21 11:44:38 +01:00
parent 3dc8a7f232
commit 42153f2e27
2 changed files with 6 additions and 2 deletions

View File

@ -39,5 +39,5 @@ async def generate_response(request: Request, template_name: str, **additional_c
@router.get("/sidebar/embed.html", response_class=HTMLResponse)
async def embed_sidebar(request: Request):
return await generate_response(request, "sidebar/embed.html")
async def embed_sidebar(request: Request, max_days: int = None):
return await generate_response(request, "sidebar/embed.html", max_days=int(max_days))

View File

@ -1,3 +1,7 @@
{% if max_days %}
{% set grouped_events = grouped_events[:max_days] %}
{% endif %}
{% for start_date, events in grouped_events %}
<div class="calendar-date">
<div class="calendar-date-date">