OpenSlides/server/openslides/topics/projector.py

33 lines
795 B
Python
Raw Normal View History

2018-12-23 11:05:38 +01:00
from typing import Any, Dict
2019-02-13 10:12:55 +01:00
from ..utils.projector import (
ProjectorAllDataProvider,
get_model,
2019-02-13 10:12:55 +01:00
register_projector_slide,
)
async def topic_slide(
all_data_provider: ProjectorAllDataProvider,
element: Dict[str, Any],
projector_id: int,
2019-02-21 14:40:07 +01:00
) -> Dict[str, Any]:
2018-12-23 11:05:38 +01:00
"""
Topic slide.
2019-02-13 10:12:55 +01:00
The returned dict can contain the following fields:
* title
* text
2018-12-23 11:05:38 +01:00
"""
topic = await get_model(all_data_provider, "topics/topic", element.get("id"))
item = await get_model(all_data_provider, "agenda/item", topic["agenda_item_id"])
return {
"title": topic["title"],
"text": topic["text"],
"item_number": item["item_number"],
}
def register_projector_slides() -> None:
register_projector_slide("topics/topic", topic_slide)