diff --git a/oedb/resources/demo.py b/oedb/resources/demo.py
index 09730c2..827b7ae 100644
--- a/oedb/resources/demo.py
+++ b/oedb/resources/demo.py
@@ -18,6 +18,19 @@ class DemoResource:
Handles the /demo endpoint and related demo pages.
"""
+ def __init__(self):
+ """
+ Initialize the resource with a Jinja2 environment.
+ """
+ # Set up Jinja2 environment
+ import jinja2
+ import os
+ template_dir = os.path.join(os.path.dirname(__file__), 'demo', 'templates')
+ self.jinja_env = jinja2.Environment(
+ loader=jinja2.FileSystemLoader(template_dir),
+ autoescape=jinja2.select_autoescape(['html', 'xml'])
+ )
+
def on_get_edit(self, req, resp, id=None):
"""
Handle GET requests to the /demo/edit endpoint.
@@ -1995,63 +2008,22 @@ class DemoResource:
Show a map with the event location and a table of its properties.
"""
import requests
+ import json
logger.info(f"Processing GET request to /demo/by_id/{id}")
try:
resp.content_type = 'text/html'
r = requests.get(f"https://api.openeventdatabase.org/event/{id}")
r.raise_for_status()
feature = r.json()
- html = f"""
-
-
-