heroweb/lib/webcomponents/main/render.py

28 lines
598 B
Python
Raw Normal View History

2024-09-14 03:59:42 +00:00
import os
from jinja2 import Environment, FileSystemLoader
from webcomponents.main.model_view import example
def render(timeline_id: int = 0) -> str:
# Create an agenda instance
mydoc = example()
# Set up Jinja2 environment and load the template
base_dir = os.path.dirname(__file__)
env = Environment(
loader=FileSystemLoader(searchpath=f'{base_dir}/templates')
)
# pudb.set_trace()
template = env.get_template('index.html')
# Render the template with the agenda data
output = template.render(doc=mydoc)
print(output)
return output