diff --git a/main.ipynb b/main.ipynb index 3a26c15..046a0b3 100644 --- a/main.ipynb +++ b/main.ipynb @@ -1709,7 +1709,9 @@ " exhibition = await exhibition_collection.find_one({'_id': ObjectId(exhibition_id)})\n", " if exhibition:\n", " posts = [doc async for doc in get_delivery_aggregate({\"exhibition_id\": exhibition_id}, ['Получено', 'Получено галерей', 'Продано', 'На выставке'])]\n", - " \n", + " for i in posts:\n", + " if (post_id:=i.get('post_id')) and 'post' not in i:\n", + " i['post'] = posts_collection.find_one({'_id': ObjectId(post_id)})\n", " return templates.TemplateResponse(\n", " request=request, name=\"exhibition/index.html\", context={\"id\": 1, \"user\": user, \"exhibition\": exhibition, \"posts\": posts, 'now': datetime.now()}\n", " )\n", diff --git a/main.py b/main.py index d4a453e..65e2d00 100644 --- a/main.py +++ b/main.py @@ -1280,7 +1280,9 @@ async def exhibition_members( exhibition = await exhibition_collection.find_one({'_id': ObjectId(exhibition_id)}) if exhibition: posts = [doc async for doc in get_delivery_aggregate({"exhibition_id": exhibition_id}, ['Получено', 'Получено галерей', 'Продано', 'На выставке'])] - + for i in posts: + if (post_id:=i.get('post_id')) and 'post' not in i: + i['post'] = posts_collection.find_one({'_id': ObjectId(post_id)}) return templates.TemplateResponse( request=request, name="exhibition/index.html", context={"id": 1, "user": user, "exhibition": exhibition, "posts": posts, 'now': datetime.now()} )