""" Views ===== Views serving browser viewable, HTML web pages. Functions --------- index Home page """ # This file is part of transport-accessibility. # Copyright (C) 2024 Janek Kiljanski, Johannes Randerath # # transport-accessibility is free software: you can redistribute it and/or modify it under the terms of the # GNU General Public License as published by the Free Software Foundation, either version 3 # of the License, or (at your option) any later version. # # transport-accessibility is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with transport-accessibility. # If not, see . from django.shortcuts import render from . import query import json def index(request): """ Home page view serving the default index page. Context ------- "Stops": Json Representation of all stops found in the database "Routes": Json Representation of all routes found in the database """ context = { "stops": json.dumps(query.get_all_stops()), "routes": json.dumps(query.get_all_routes()), } return render(request, "map.html", context)