Jsonizing data to pass to index

This commit is contained in:
Johannes Randerath 2024-06-11 19:22:11 +02:00
parent 90f76c2a30
commit 0031646016

View File

@ -12,6 +12,7 @@ from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .models import * from .models import *
from .forms import * from .forms import *
import json
def print_r(r, s): def print_r(r, s):
if not len(r): if not len(r):
@ -44,6 +45,6 @@ def index(request):
print(timetable) print(timetable)
timetables[r["route_id"]] = timetable timetables[r["route_id"]] = timetable
context = {"stops": stops, "routes": routes, "timetables": timetables} context = {"data": json.dumps({"stops": stops, "routes": routes, "timetables": timetables})}
return render(request,"map.html", context) return render(request,"map.html", context)