diff --git a/main.ipynb b/main.ipynb index 5e77642..74ab49b 100644 --- a/main.ipynb +++ b/main.ipynb @@ -1750,7 +1750,7 @@ " 'prod': PROD\n", " }).sort({'_id':-1}).limit(1000).to_list()\n", " return templates.TemplateResponse(\n", - " request=request, name=\"exhibitions.html\", context={\"id\": 1, \"user\": user, \"exhibitions\": exhibitions}\n", + " request=request, name=\"exhibitions.html\", context={\"id\": 1, \"user\": user, \"exhibitions\": exhibitions, 'now': datetime.now()}\n", " )" ], "display_name": ".venv" diff --git a/main.py b/main.py index ac75bad..2673c06 100644 --- a/main.py +++ b/main.py @@ -1301,7 +1301,7 @@ async def exhibitions_all( 'prod': PROD }).sort({'_id':-1}).limit(1000).to_list() return templates.TemplateResponse( - request=request, name="exhibitions.html", context={"id": 1, "user": user, "exhibitions": exhibitions} + request=request, name="exhibitions.html", context={"id": 1, "user": user, "exhibitions": exhibitions, 'now': datetime.now()} ) @app.get("/competitions", response_class=HTMLResponse) diff --git a/templates/exhibition/index.html b/templates/exhibition/index.html index fb945ba..d493037 100644 --- a/templates/exhibition/index.html +++ b/templates/exhibition/index.html @@ -27,14 +27,16 @@ Назад - {% if exhibition.get('status',-1) == 2 %} -
- Выставка закончилась -
- {% else %} -
- Идет выставка +
+ {% if now > exhibition.date_finish %} + Закончилась + {% elif now > exhibition.datetime_start %} + Началась + {% else %} + Формируется + {% endif %}
+ {% if now < exhibition.date_finish %} До {{ (exhibition.date_finish.strftime('%d.%m.%Y')) if exhibition.date_finish else ''}} {% endif %}
diff --git a/templates/exhibitions.html b/templates/exhibitions.html index c6ff505..6253fc0 100644 --- a/templates/exhibitions.html +++ b/templates/exhibitions.html @@ -34,16 +34,15 @@ {% if link %} {% endif %} - {% if exhibition.get('status',-1) == 2 %} -
- Выставка закончилась +
+ {% if now > exhibition.date_finish %} + Закончилась + {% elif now > exhibition.datetime_start %} + Началась + {% else %} + Формируется + {% endif %}
- {% else %} -
- Идет выставка -
- - {% endif %}

{{ exhibition.title }}